When there is no cam, the other party's cam screen does not stream

When there is no cam, the other party’s cam screen does not stream

If I don’t have a cam and the other person has a cam
The other party’s cam is not streaming.

If you have a cam, the other person’s cam will also be streamed.

I want to stream the other party’s cam screen even if I don’t have a cam.
what should I do?

This could be a simple problem related to the autoplay behavior of the client browser. Some browsers do not allow autoplaying videos with audio tracks if there is not a user gesture. The thing is that giving permission to the camera also counts as a valid user gesture in this case, so when users publish their own camera the autoplay feature for remote videos will always work fine. But if there is no camera access, then it is possible that you may have to start the remote video muted (which will allow playing the video, just not the audio), and warn the user to manually unmute the video to start listening to the remote user.

Isn’t there an automatic, not a manual one?

Again, this is not really a problem with OpenVidu, but with how client platforms behave upon an autoplay attempt. Your application should manage it on its own. If the user has not published their own camera and the remote video does not play in X seconds (you can use the openvidu-browser ExceptionEvent with name NO_STREAM_PLAYING_EVENT for that matter), make sure your app warns the client to click on the play button of the remote video, which should be paused.

Are you saying you have to create a button that plays the other person’s video and click it?

Yes, you have to take care of it on your own client application:

  1. Detect that the person does not have a camera.
  2. When the person subscribes to a remote video, you need to know if it did not autoplay. As explained above, you can listen to the ExceptionEvent with name NOT_STREAM_PLAYING_EVENT to realize that the remote video did not autoplay.
  3. In this case, show a “play” button on the remote video and call video.play() JS method when clicked. You can warn the person in any way that suits you, that’s up to your app desing and your liking. The idea is: “Hey! This video could not start autoplaying on its own. Please click this button to start seeing the other person”

Best regards.

Sorry, but is there a way to catch the exception event?

session.on(‘exception’, function (event) {
console.log(“Exception Event” + event);
});

is this right?

Yes. And check the event object to differentiate between all the possible ExceptionEvents, using its name property. In this case you are only interested in NO_STREAM_PLAYING_EVENT.

I have implemented it as you suggested, but no exception event is raised.
What more should we see?