setSrcObject method
Future<void>
setSrcObject(
{ - MediaStream? stream,
- String? trackId,
})
inherited
Implementation
Future<void> setSrcObject({MediaStream? stream, String? trackId}) async {
if (_disposed) {
throw 'Can\'t set srcObject: The RTCVideoRenderer is disposed';
}
if (_textureId == null) throw 'Call initialize before setting the stream';
_srcObject = stream;
var oldTextureId = _textureId;
try {
await WebRTC.invokeMethod('videoRendererSetSrcObject', <String, dynamic>{
'textureId': _textureId,
'streamId': stream?.id ?? '',
'ownerTag': stream?.ownerTag ?? '',
'trackId': trackId ?? '0'
});
value = (stream == null)
? RTCVideoValue.empty
: value.copyWith(renderVideo: renderVideo);
} on PlatformException catch (e) {
throw 'Got exception for RTCVideoRenderer::setSrcObject: textureId $oldTextureId [disposed: $_disposed] with stream ${stream?.id}, error: ${e.message}';
}
}