From d1b1c68e0e82853106e73d4a4442e1bc9a1517ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Mon, 26 Oct 2020 14:39:38 +0100 Subject: [PATCH] MOBILE-3543 emulator: Use new HTMLMediaElement when capturing --- src/core/emulator/pages/capture-media/capture-media.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/emulator/pages/capture-media/capture-media.ts b/src/core/emulator/pages/capture-media/capture-media.ts index 42324569a..0bf1c5912 100644 --- a/src/core/emulator/pages/capture-media/capture-media.ts +++ b/src/core/emulator/pages/capture-media/capture-media.ts @@ -192,7 +192,13 @@ export class CoreEmulatorCaptureMediaPage implements OnInit, OnDestroy { }; // 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. waitTimeout = setTimeout(() => {