Skip to content

Commit d1b1c68

Browse files
committed
MOBILE-3543 emulator: Use new HTMLMediaElement when capturing
1 parent afa92f4 commit d1b1c68

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/core/emulator/pages/capture-media/capture-media.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ export class CoreEmulatorCaptureMediaPage implements OnInit, OnDestroy {
192192
};
193193

194194
// Set the stream as the source of the video.
195-
this.streamVideo.nativeElement.src = window.URL.createObjectURL(this.localMediaStream);
195+
if ('srcObject' in this.streamVideo.nativeElement) {
196+
this.streamVideo.nativeElement.srcObject = this.localMediaStream;
197+
} else {
198+
// Fallback for old browsers.
199+
// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject#Examples
200+
this.streamVideo.nativeElement.src = window.URL.createObjectURL(this.localMediaStream);
201+
}
196202

197203
// If stream isn't ready in a while, show error.
198204
waitTimeout = setTimeout(() => {

0 commit comments

Comments
 (0)