File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ class RTCVideoRenderer extends ValueNotifier<RTCVideoValue>
17
17
18
18
@override
19
19
Future <void > initialize () async {
20
+ if (_textureId != null ) {
21
+ return ;
22
+ }
20
23
final response = await WebRTC .invokeMethod ('createVideoRenderer' , {});
21
24
_textureId = response['textureId' ];
22
25
_eventSubscription = EventChannel ('FlutterWebRTC/Texture$textureId ' )
@@ -61,11 +64,13 @@ class RTCVideoRenderer extends ValueNotifier<RTCVideoValue>
61
64
@override
62
65
Future <void > dispose () async {
63
66
await _eventSubscription? .cancel ();
64
- await WebRTC .invokeMethod (
65
- 'videoRendererDispose' ,
66
- < String , dynamic > {'textureId' : _textureId},
67
- );
68
-
67
+ _eventSubscription = null ;
68
+ if (_textureId != null ) {
69
+ await WebRTC .invokeMethod ('videoRendererDispose' , < String , dynamic > {
70
+ 'textureId' : _textureId,
71
+ });
72
+ _textureId = null ;
73
+ }
69
74
return super .dispose ();
70
75
}
71
76
You can’t perform that action at this time.
0 commit comments