OpenVidu / openvidu

OpenVidu Platform main repository
https://openvidu.io
Apache License 2.0
1.9k stars 463 forks source link

Cannot get MediaStream from Electron app to browser via Openvidu media server. #629

Open duyminhnguyen97 opened 3 years ago

duyminhnguyen97 commented 3 years ago

Hi all, I'm currently having an issue with openvidu-browser-2.17.0.js I'm trying to transfer a camera stream from RTSP to an Openvidu media server deployed on cloud and get the stream back on the browser.

The RTSP stream was converted into an HLS stream using FFmpeg and played using hls.js. It was captured in an video tag in HTML and I used the HTMLMediaElement.captureStream().getVideoTrack() to generate MediaStreamTrack and passed it into the videoSource property in initPublisher. This publisher part was wrapped in electron. Then, the stream was connected to our cloud Openvidu server deployed on-premises exactly like in the Docs (https://docs.openvidu.io/en/2.18.0/deployment/deploying-on-premises/). The subscriber part is a simple HTML page displayed on the browser to get the stream from the cloud server. The subscriber is responsible for creating session and generating stream from the media server when streamCreated event occurs.

The whole workflow worked nicely when we tested it with our webcam, however, when we use MediaStreamTrack of our stream video instead of webcam, the subscriber part only showed the blank video.

Does anyone know what the issue is? Thanks!

Describe the bug Cannot get MediaStream from Electron app to browser via Openvidu media server.

Expected behavior Receive the stream from the Electron app to browser via Openvidu media server.

Wrong current behavior Only get blank video

Client device info (if applicable)

Screenshots

Additional context

micaelgallego commented 3 years ago

Why are not using native RTSP support in OpenVidu? https://docs.openvidu.io/en/2.18.0/advanced-features/ip-cameras/

In any case, have you tested in browser? Does it work on browser and fails in electron?

duyminhnguyen97 commented 3 years ago

@micaelgallego I used the native RTSP support in OpenVidu, however, it only worked with my local server, not the remote server. As far as I know, I cannot get the RTSP stream from outside of the local network. That's why I changed the approach to stream the video from MediaStream instead. Do you have any suggestions to work with RTSP from the remote server? I haven't tried in the browser, but I can make a test. Nevertheless, can I stream the MediaStream from HTML to the remote OpenVidu server as I described above?