stephenlb / webrtc-sdk

WebRTC Simple Calling API + Mobile SDK - A simplified approach to RTCPeerConnection for mobile and web video calling apps.
https://stephenlb.github.io/webrtc-sdk/
MIT License
853 stars 278 forks source link

Video always freezes! #61

Closed crookedbard closed 5 years ago

crookedbard commented 5 years ago

Pubnub server started to freeze videos. From 2018-10-17 UTC 2:00 PM

crookedbard commented 5 years ago

It seems yesterday changes made the video freeze, not only on iOS Safari but on all browsers.

stephenlb commented 5 years ago

Will be working on this to resolve.

stephenlb commented 5 years ago

getting closer...

stephenlb commented 5 years ago

Getting a lot closer! Safari 12 can send/receive calls to any other browser! However Safari is still unable to call Safari successfully.

crookedbard commented 5 years ago

We had issues when calling from chrome to mozzila fire fox? We used to get cross origin issue.

stephenlb commented 5 years ago

Apple’s WebRTC implementation only allows one getUserMedia capture at a time. So this is why I've never been able to get Safari to work.

stephenlb commented 5 years ago

Video Freezing: https://blog.mozilla.org/webrtc/when-your-video-freezes/ - this may be the fix

crookedbard commented 5 years ago

Windows OS: Chrome to Chrome video still freezes. Caller A calls Caller B, A video is normal on both callers but B video is frozen on both callers.

crookedbard commented 5 years ago

Caller A debug log: image Caller B debug log: image

stephenlb commented 5 years ago

Just submitted the next release with a much needed race condition fix on signaling exchanges. This may have improved the conditions you mentioned.

crookedbard commented 5 years ago

I just checked it. Still same issue. Tested on Chrome Version 69.0.3497.100 (Official Build) (64-bit). Before commits on Oct 17, 2018 4d8a1fda450e2830b170644df65a93e579c9a985 , e6e8531ffc8396cdb4e9384ff5df9c3ab84ae0c0 , a4d565b552ac0147fc94c72d644569c3b776fe9b video wouldn't freeze but now it does. I use both local video cam and callers video cam on both sides of the connection. So the caller sees itself and the participant, same at the participants end. Callers video is not frozen on both the callers (local) side and the participants, but the participants video is frozen on local and callers side.

crookedbard commented 5 years ago

Ok I found the issue. To ensure that the video will be shown I had this code before:

var videoStreamActive = false;
phone.receive(function(session) {
            console.log('receive');

// Display Your Friend's Live Video
session.connected(function (session) {

    // Work arround the issue when the video is not always shown.
    session.video.srcObject.onaddtrack = function(event) {
                            videoStreamActive = true;
                        };

    session.video.srcObject.oninactive = function(event) {
        videoStreamActive = false;
    };

    session.video.onloadedmetadata = function(e) {
        if (videoStreamActive) {
            //video is always shown.
            video.appendChild(session.video);
        }
    };

});

But now because of this code the video of participants is always frozen. When I remove this then the video is not frozen, but I need to ensure that the video will always be shown to the user.