Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ctxSip doesnt work on android phone , Iphone #52

Open
beatific-angel opened this issue Jul 22, 2022 · 5 comments
Open

ctxSip doesnt work on android phone , Iphone #52

beatific-angel opened this issue Jul 22, 2022 · 5 comments

Comments

@beatific-angel
Copy link

if I access via android, iphone, then I can see unssuported browser error message.
As my checking result, this is related with getUserMedia.

correctly the part is hasWebRTC : function() {} .

so I added some code in here.
navigator.mediaDevices.enumerateDevices().then(function(deviceInfos){
// deviceInfos will not have a populated lable unless to accept the permission
// during getUserMedia. This normally happens at startup/setup
// so from then on these devices will be with lables.
HasVideoDevice = false;
HasAudioDevice = false;
HasSpeakerDevice = false; // Safari and Firefox don't have these
AudioinputDevices = [];
VideoinputDevices = [];
SpeakerDevices = [];
var savedVideoDevice = 'default';
var videoDeviceFound = false;

                    var savedAudioDevice = 'default';
                    var audioDeviceFound = false;

                    var MicrophoneFound = false;
                    var SpeakerFound = false;
                    var VideoFound = false;
                    for (var i = 0; i < deviceInfos.length; ++i) {
                        if (deviceInfos[i].kind === "audioinput") {
                            MicrophoneFound = true;
                            HasAudioDevice = true;
                            AudioinputDevices.push(deviceInfos[i]);
                        }
                        else if (deviceInfos[i].kind === "audiooutput") {
                            SpeakerFound = true;
                            HasSpeakerDevice = true;
                            SpeakerDevices.push(deviceInfos[i]);
                        }
                        else if (deviceInfos[i].kind === "videoinput") {
                            HasVideoDevice = true;
                            VideoinputDevices.push(deviceInfos[i]);
                        }
                    }
                    console.log(AudioinputDevices, VideoinputDevices);

                    var contraints = {
                        audio: MicrophoneFound,
                        video: VideoFound
                    }

                    if(MicrophoneFound){
                        contraints.audio = { deviceId: "default" }
                        if(audioDeviceFound) contraints.audio.deviceId = { exact: savedAudioDevice }
                    }
                    if(VideoFound){
                        contraints.video = { deviceId: "default" }
                        if(videoDeviceFound) contraints.video.deviceId = { exact: savedVideoDevice }
                    }
                    // Additional

                    console.log("Get User Media", contraints);
                    // Get User Media
                    navigator.mediaDevices.getUserMedia(contraints).then(function(mediaStream){
                        // Handle Video
                        var videoTrack = (mediaStream.getVideoTracks().length >= 1)? mediaStream.getVideoTracks()[0] : null;
                        if(VideoFound && videoTrack != null){
                            localVideoStream.addTrack(videoTrack);
                            // Display Preview Video
                            localVideo.srcObject = localVideoStream;
                            localVideo.onloadedmetadata = function(e) {
                                localVideo.play();
                            }
                        }
                        else {
                            console.warn("No video / webcam devices found. Video Calling will not be possible.")
                        }

                        // Handle Audio
                        var audioTrack = (mediaStream.getAudioTracks().length >= 1)? mediaStream.getAudioTracks()[0] : null ;
                        if(MicrophoneFound && audioTrack != null){
                            localMicrophoneStream.addTrack(audioTrack);
                            // Display Micrphone Levels
                            window.SettingsMicrophoneStream = localMicrophoneStream;
                            window.SettingsMicrophoneSoundMeter = MeterSettingsOutput(localMicrophoneStream, "Settings_MicrophoneOutput", "width", 50);
                        }
                        else {
                            console.warn("No microphone devices found. Calling will not be possible.")
                        }

                        // Display Output Levels
                        $("#Settings_SpeakerOutput").css("width", "0%");
                        $("#Settings_RingerOutput").css("width", "0%");
                        if(!SpeakerFound){
                            console.log("No speaker devices found, make sure one is plugged in.")
                            $("#playbackSrc").hide();
                            $("#RingDeviceSection").hide();
                        }

                        // Return .then()
                        return navigator.mediaDevices.enumerateDevices();
                    }).catch(function(e){
                        console.error(e);
                        Alert(lang.alert_error_user_media, lang.error);
                    });
                }).catch(function(e){
                    console.error("Error enumerating devices", e);
                });

Then I can see detect audio and video media.
but when try call, I can see this error.

sip-0.10.0.js:807 Fri Jul 22 2022 06:19:10 GMT+0300 (Moscow Standard Time) | sip.invitecontext.sessionDescriptionHandler | unable to acquire streams
sip-0.10.0.js:807 DOMException: Requested device not found.

please check and help me this problem

@ROBERT-MCDOWELL
Copy link

you should always provide your browser and OS name/version

@beatific-angel
Copy link
Author

beatific-angel commented Jul 22, 2022

Chrome
Android 6+ , IOS 11+

@ROBERT-MCDOWELL
Copy link

chrome must be version 64+....

@beatific-angel
Copy link
Author

beatific-angel commented Jul 23, 2022

yes . the chrome version is 99+
that is not related with chrome.
as i mentioned already, this problem is related with getUserMedia.
about this problem, please check your code and solve this problem

@ROBERT-MCDOWELL
Copy link

It's not my code.... and if you thnk it comes from it so fork the project and create a PR.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants