xyz.html
<video id="localVideo" #localVideo autoplay="autoplay"></video> <video id="remoteVideo" #remoteVideo autoplay="autoplay"></video> <button (click)="startVideoCall()">Start video call </button>
xyz.ts
@ViewChild ('localVideo') public localVideo:ElementRef;
@ViewChild ('remoteVideo') public remoteVideo:ElementRef;
//on getUserMedia
this.localVideo.nativeElement.src = window.URL.createObjectURL(stream);
this.localVideo.nativeElement.play();
// on receiving the remote stream
this.remoteVideo.nativeElement.src = window.URL.createObjectURL(event.stream);
this.remoteVideo.nativeElement.play();
I am using WebRTC for a video call application. The issue is i am able to see my local video. But the same doesnt work for remote video. When i do inspect element on remoteVideo video tag i can see the url. The enitre tag when i receive the remote stream is as follows : <video _ngcontent-c7="" autoplay="autoplay" id="remoteVideo" src="blob:http://localhost:4200/832b72ca-4184-4215-9ab6-276242bf0291"></video>
but the video is not visible. Any help would be appreciated. Thank you.
Maybe this way, to support both types:
try {
this.remoteVideo.nativeElement.srcObject = event.stream;
} catch(error) {
this.remoteVideo.nativeElement.src = URL.createObjectURL(event.stream);
};
this.remoteVideo.nativeElement.play();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.