WebRTC Plugin-free Screen Sharing & WebSync as Signaling GateWay!

Copyright © 2013 Muaz Khan<@muazkh> » @WebRTC Experiments » Google+ » What's New?

Private ?? #123456789

How to use WebSync for Signaling?

// ------------------------------------------------------------------
// start-using WebSync for signaling
var channels = {};
var username = Math.round(Math.random() * 60535) + 5000;

var client = new fm.websync.client('websync.ashx');

client.setAutoDisconnect({
    synchronous: true
});

client.connect({
    onSuccess: function () {
        client.join({
            channel: '/chat',
            userId: username,
            userNickname: username,
            onReceive: function (event) {
                var message = JSON.parse(event.getData().text);
                if (channels[message.channel] && channels[message.channel].onmessage) {
                    channels[message.channel].onmessage(message.message);
                }
            }
        });
    }
});

function openSocket(config) {
    var channel = config.channel || 'Plugin-free-screen-sharing';
    channels[channel] = config;

    if (config.onopen) setTimeout(config.onopen, 1000);
    return {
        send: function (message) {
            client.publish({
                channel: '/chat',
                data: {
                    username: username,
                    text: JSON.stringify({
                        message: message,
                        channel: channel
                    })
                }
            });
        }
    };
}
// end-using WebSync for signaling
// ------------------------------------------------------------------

var config = {
     openSocket: openSocket,
     onRemoteStream: function() {},
     onRoomFound: function() {}
};
  1. Share full screen with one or more users in HD format!
  2. Make sure you enabled the flag "Enable screen capture support in getUserMedia" via "chrome://flags".

    Screen-sharing fails if you've not enabled that flag.
  3. Recursive cascade images or blurred screen experiences occur only when you try to share screen between two tabs on the same system. This NEVER happens when sharing between unique systems or devices.
  4. Firefox has no support of screen-sharing yet.
  5. Remember, it is not desktop sharing!

Latest Updates

Feedback

Enter your email too; if you want "direct" reply!

Why Screen Sharing Fails?

  1. You've not used 'chromeMediaSource' constraint:
    mandatory: {chromeMediaSource: 'screen'}
    
  2. You requested audio-stream alongwith 'chromeMediaSource' – it is not permitted.
  3. You're not testing it on SSL origin (HTTPS domain).
  4. Screen capturing is requested multiple times. Multiple capturing of screen is not allowed even from two unique tabs.

mandatory: {chromeMediaSource: 'tab'} is useful only in chrome extensions. See Tab sharing using tabCapture APIs.

Suggestions

  1. If you're newcomer, newbie or beginner; you're suggested to try RTCMultiConnection.js or DataChannel.js libraries.
Web hosting by Somee.com