minimal webrtc check

Discussion in 'Web Call Server 5' started by SLM, May 18, 2017.

  1. SLM

    SLM New Member

    Do you have a minimal javascript function to check whether or not the browser someone is using supports playing a webrtc stream? A standard webrtc check always fails on iOS but playing a stream is still possible because you have implemented another way to play those streams. I do not want to load the entire flashphoner javascript library (500k - 1mb) just to check it. Our mobile website that uses WC5 only loads scripts as needed, so if you could provide us with a basic function to test this capability, it would be much appreciated. It doesn't matter if that check would be 80% accurate in positives (the flashphoner.init would serve as the final check), as long as it's 100% accurate in negatives and so reduces inital pageload and increases initial pagespeed.

    I also have a question regarding resolutions and resizing/transcoding. It seems that if the player is sized differently than the stream, some transcoding occurs. I want to resize the video-element on the player without impacting the stream or bandwidth either negatively or positively. For example: if the player on a webpage requests a 320x240 stream and the user flips his phone to display the site vertically making the video element half it's original size, there should not be any difference in the requested stream. How can I achieve this?
  2. Max

    Max Administrator Staff Member

    We will check what we can do to provide such quick check.

    We have discussed similar issue here:
    http://forum.flashphoner.com/threads/two-streams-on-safari.10866/#post-12515
    Code:
    It seems that if the player is sized differently than the stream, some transcoding occurs.
    You have to pass 0x0 resolution to avoid server-side transcoding.
    If you pass 320x240, your stream will be transcoded and rescaled to 320x240.
    Using resize() function you can adjust aspect ratio as described here.
  3. Max

    Max Administrator Staff Member

    Regarding WebRTC check.
    WCS SDK has three media providers:
    1. WebRTC
    2. Flash
    3. Websocket
    WebRTC has higher priority.

    Each provider has own JavaScript file
    webrtc-media-provider.js
    flash-media-provider.js
    websocket-media-provider.js

    And each of js files has method available();
    WebRTC
    Code:
    var available = function () {
        return (adapter.browserDetails.browser != "edge") ? navigator.getUserMedia && RTCPeerConnection : false;  
    };
    Flash
    Code:
    var available = function() {
        return swfobject.hasFlashPlayerVersion("11.2.0");
    };
    Websocket
    Code:
    var available = function(audioContext){
        return (audioContext) ? true : false;
    };
    As you can see, we check this:
    Code:
    navigator.getUserMedia && RTCPeerConnection
    and if it returns true and browser is not MS Edge, we detect WebRTC support.

    Regarding Flash and Websocket media providers, it is bit complex because it uses swfobject and audioContext objects.

Share This Page