MOBILE-3543 emulator: Use new HTMLMediaElement when capturing

main
Pau Ferrer Ocaña 2020-10-26 14:39:38 +01:00
parent afa92f4d71
commit d1b1c68e0e
1 changed files with 7 additions and 1 deletions

View File

@ -192,7 +192,13 @@ export class CoreEmulatorCaptureMediaPage implements OnInit, OnDestroy {
}; };
// Set the stream as the source of the video. // Set the stream as the source of the video.
this.streamVideo.nativeElement.src = window.URL.createObjectURL(this.localMediaStream); if ('srcObject' in this.streamVideo.nativeElement) {
this.streamVideo.nativeElement.srcObject = this.localMediaStream;
} else {
// Fallback for old browsers.
// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject#Examples
this.streamVideo.nativeElement.src = window.URL.createObjectURL(this.localMediaStream);
}
// If stream isn't ready in a while, show error. // If stream isn't ready in a while, show error.
waitTimeout = setTimeout(() => { waitTimeout = setTimeout(() => {