Connection when there is no camera

An error occurs when connecting when there is no camera.
To solve the error, I got the device with getUserMedia and if it does not exist, I set the parameters of initPublisher as follows.

publisher = OV.initPublisher(‘video-container’, {
audioSource: undefined, // The source of audio. If undefined default audio input
videoSource: undefined, // The source of video. If undefined default video input
publishAudio: false, // Whether to start publishing with your audio unmuted or not
publishVideo: false, // Whether to start publishing with your video enabled or not
resolution: layoutWidth + ‘x’ + layoutHeight, // The resolution of your video
frameRate: 30, // The frame rate of your video
insertMode: ‘PREPEND’, // How the video is inserted in target element ‘video-container’
mirror: false // Whether to mirror your local video or not
});

But the browser gives me the following error:

  • getMediaError: NotFoundError: Requested device not found
  • Publisher initialization failed. INPUT_VIDEO_DEVICE_NOT_FOUND: NotFoundError: Requested device not found

How can I solve this?

If there are no input media devices, of course trying to initialize a Publisher will produce an error. That is actually the expected behavior.
You can simply manage this case with a try - catch code block. If the error is of type INPUT_VIDEO_DEVICE_NOT_FOUND, then you know for sure that the problem is that there is no camera to be used by the application.

To sum it up: you are describing a normal behavior.

If it can’t be initialized, does it mean that it can’t be used without a camera?
Can’t video chat with other users without a camera?

Are you talking about a specific OpenVidu application? Any tutorial or demo app publicly available?

@pabloFuente is right, just catch the exception, and if no devices can be found, don’t publish and only subscribe to the session.

Can’t video chat with other users without a camera?

You can videochat without any device, just don’t publish and don’t init the publisher.

The session was not published and the publisher was not initialized.
Is there a way for the other party to know that a user without a camera device has logged in?
It doesn’t seem to be able to know that the other party is coming in because you don’t publish to the session.

What I want is for users without a camera, to display an image in the video list by overlaying the image instead of the camera video.

@seungsun Same here. Did you solve the problem?

@x199079121800 I solved it.
I was able to solve it by checking the status of videoActive in the streamCreated event.

2 Likes