Can't get video in windows devices

I am using openvidu browser js to implement video conference in my software. I tested website on my mobile, on macbook and it works fine but in windows it is not working. I am getting video devices but as i pass device id it doesn’t show my video. I have attached my code below.

var video;
                    TOKEN = data.msg;
                    OV = new OpenVidu();
                    session = OV.initSession();
                    session.on('streamCreated', event => {
                        session.subscribe(event.stream, "subscribers");
                    });
                    session.connect(TOKEN).then(() => {
                        // var publisher = OV.initPublisher("publisher");
                        OV.getDevices().then(devices => {
                            var cameras = devices.filter((device) => device.kind === 'videoinput');
                            if (cameras.length != 0) {
                                video = cameras[0].deviceId;
                            }
                            if (video) {
                                var publisher = OV.initPublisher("publisher", {
                                    audioSource: MediaStreamTrack, // The source of audio. If undefined default microphone
                                    videoSource: video, // The source of video. If undefined default webcam
                                    publishAudio: true, // Whether you want to start publishing with your audio unmuted or not
                                    publishVideo: true, // Whether you want to start publishing with your video enabled or not
                                    resolution: '1280x720', // The resolution of your video
                                    frameRate: 60, // The frame rate of your video
                                    insertMode: 'REPLACE', // How the video is inserted in the target element 'video-container'
                                    mirror: false // Whether to mirror your local video or not
                                });
                                session.publish(publisher);
                            } else {
                                alert('No camera found on this device.');
                                $('#video_call').modal('hide');
                                return 0;
                            }
                        });

                        // session.on('sessionDisconnected', event => {
                        //     // session.forceDisconnect();
                        // });

                    }).catch(error => {
                        alert_modal_msg('error', "Error connecting to the session");
                        // console.log("Error connecting to the session", error.code, error.message);
                    });

Please can you test an official tutorial? For example, you can go to https://demos.openvidu.io and try.

The tutorials are not even working in a windows laptop…

Why not? Have you followed these tips?

https://docs.openvidu.io/en/2.13.0/troubleshooting/#3-i-am-using-windows-to-run-the-tutorials-develop-my-app-anything-i-should-know

i have tried demo website “https://demos.openvidu.io” that you provided but it is not working.the website is also having an issue.

https://demos.openvidu.io is working perfectly fine in Windows. Please, check your computer devices or your network.

i have tried on windows laptop but it is not working.

There is some problem with your webcam or microphone. Browser’s console is telling you that.

Other video services are working well? For example https://whereby.com?

Can you expand DomException error to see if there are more information?

Thank you. Logs doesn’t show anything interesting.

Can you show console logs when acceding https://demos.openvidu.io/basic-videoconference/?

Could you run into your browser console the following command and show us the result, please?

navigator.mediaDevices.enumerateDevices().then(a => console.log(a));
1 Like

As you can see, the browser does not recognizes your video devices.

  1. Do you have any video device connected to your PC?
  2. If you do, have you enable the camera permissions access to your browser?

i have given permission but it is not working.

Open your browser in Incognito mode and try again please

tried that too it asked for permission but still throws error.

Make sure that you have other browsers closed. Chrome won’t be able to access to your devices if you have another browser opened.

Check if webrtc samples works in your PC please