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);
});