WebRTC: Have to push switch button twice when starting a stream with the rear camera since WebSDK 0.5.28.2753.150

Peter P.

New Member
Hi

Before this update it was possible in the “then” call after getMediaDevices to call

JavaScript:
list.video = list.video.reverse();
and by doing so make it use the backwards facing camera to begin with.

However, from WebSDK version 0.5.28.2753.150 and onwards using this method makes the switch button malfunction. Specifically, the first push of the switch button makes it look like it switches (screen goes black), but it just “switches” back to the same camera. Afterwards, the switch button works again. So it seems like it thinks it is using the other camera.

We suspect the lines that have caused the issue are:
JavaScript:
        // WCS-2933, fix mobile streaming issues, gather info about available devices before streaming, but not during


        listDevices(false).then(function (devices) {


          devices.video.forEach(function (device) {


            videoCams.push(device.id);


          });


          devices.audio.forEach(function (device) {


            mics.push(device.id);


          });


          navigator.getUserMedia(constraints, function (stream) {


            loadVideo(display, stream, screenShare, requestAudioConstraints, resolve, constraints);


          }, reject);


        }, reject);
If this is not something you consider a bug please let us know how we can choose to start a stream with the backwards facing camera (or just the opposite of what it would do normally).

Thanks
Peter
 

Max

Administrator
Staff member
Good day.
Please check if the issue is reproducing in Media Devices example. If yes, please clarify the following:
- phone model
- phone OS version
- browser version
If the problem is reproducing in your code only, please check if you invoke the following function
Code:
Flashphoner.getMediaDevices(null, true);
before creating a stream (in init_page(); for example). Please see also this topic and Media Devices example code.
 

Peter P.

New Member
Hi Max,

Thank you for your quick reply and sorry for my late reply, I did not see any email notification of your response.
We have tried it on your media devices demo and it seems to be a bug. It is the same across iOS and Android.
This is all we do:
JavaScript:
Flashphoner.getMediaDevices(null, true).then(function (list) {
    //... removed for brevity
    list.video.reverse();//<----- This is our only change
    list.video.forEach(function (device) {
    //... removed for brevity
    })
})
We have a sample ready for you to test, if you provide us with a place to upload it.

Thanks
- Peter
 

Peter P.

New Member
I have tried twice now in Chrome and Firefox, but i get this error message:
Cообщение <1612178213.6017e325651b5@flashphoner.com> для support@flashphoner.com не было доставлено через ApMailer\Smtp. Ошибка: 104: Не удалось считать данные из сокета. Ошибка: Undefined index: cert_private_key
I uploaded it to a site and provided a link instead...
 
Last edited:

Max

Administrator
Staff member
We checked the code.
You don't need to reverse the list. Just addthe following code after list.video.forEach call:
Code:
        var video = document.getElementById("videoInput");
        for (var i = 0; i < video.options.length; i++) {
            if (video.options[i].text.toLowerCase().indexOf("back") >= 0) {
                $('#videoInput').val(video.options[i].value);
                break;
            }
        }
In this case, publishing will start from back camera.
Also, we confirm that switchCam call switches furst time to the same camera if this is last device in list returned by navifgator.getUserMedia. We raised the ticket WCS-3057 and let you know results here.
As workaround, you can collect device Ids and switch exactly to the camera by invoking stream.switchCam(deviceId)
 

Peter P.

New Member
Thanks Max!

That seems like a better solution, but my experience is that the names of the cameras are not always labeled consistently or helpful.
But they might have gotten better since last we tried, so it is worth a shot.
I will look forward to updates.
 
Top