Cannot View Stream from Janus-Gateway in Vuejs on page change

785 views Asked by At

I have been working with the Janus Gateway server to provide a WebRTC stream to a Vuejs application.

I have tried two different clients in order to setup the WebRTC connection and bind the video element to the mediastream object. I have had success with both the native janus.js, as well as the janus-api client using this gist.

Both of these libraries initiate a connection with the RESTAPI and Websocket Janus Api and I get a video stream in the browser as expected.

However when I leave the page and return I am unable to view the video feed. I am using vue-router which destroys the component including the video element as well as the janus session and plugin. This does not reload the browser page (if I do this it works as expected).

All of the browser console logs from the janus clients are identical between the first and second times visiting the page. No errors all handshakes are successful. The only difference is their is no stream shown.

Can a second webrtc connection be established without a page reload, even after the first is destroyed?

1

There are 1 answers

0
Bradley Schwarz On

The problem turned out to be due to the fact that I stopped sending the Janus server frames when the page was changed. This caused the UDP stream to deconstruct within the janus server. Then recreate when the page was returned to. The creation of a new stream caused the WebRTC handshake to fail. I changed my approach to never stop sending frames and the page changes now work properly.