2

I am using PubNub's WebRTC API for video and audio conversations which works like a charm. Next I would like to add screen sharing to my application, but I can't find any useful info inside their documentation, in turn they have the option mentioned in several places.

the code I use right now:

var phone = window.phone = PHONE({
            number        :  $('#user_email').text() || "Anonymous", // listen on username line else Anonymous
            publish_key   : 'pub-xxx',
            subscribe_key : 'sub-xxx',
        }); 

        phone.ready(function(){ 
            $('#vid-box').show();
            $('#video-switch').addClass('switch-on');

            });

        phone.receive(function(session){
            session.connected(function(session) { 
            video_out.appendChild(session.video); 
            });

            session.ended(function(session) {
                 video_out.innerHTML='';
                  });
        });



    function startVideo(){
        if (!window.phone) {
             alert("Login First!");
             return false;

        } else {
             phone.dial( $('#other_side').text('ON') );
             $('#cam-button-text').text('Stop Video');
        }

    }
Craig Conover
  • 4,710
  • 34
  • 59
Edmond Tamas
  • 3,148
  • 9
  • 44
  • 89
  • Please refer to this SO thread for details and let me know if you still have further questions: http://stackoverflow.com/questions/28740230/how-to-use-webrtc-pubnub-api-for-video-chat-client-in-native-android-app – Craig Conover Nov 13 '15 at 00:03
  • 1
    And this Codoodler demo app might be a more appropriate resource for what you are asking: https://www.pubnub.com/blog/2014-09-03-multiuser-draw-html5-canvas-tutorial/ – Craig Conover Nov 13 '15 at 00:05
  • 1
    @CraigConover thank you so much, using the Codedoodler demo, I can now successfully share a stream that I get via webkitGetUserMedia(); One more question, Is there a way I could add a "phone number", like in the video call example so I can share the stream between specific users only? Ps, please add your comment as an answer. – Edmond Tamas Nov 13 '15 at 13:31
  • doesn't the WebRTC demo @ http://webrtc.co provide the details you need to add the phone number to connect two users? – Craig Conover Nov 18 '15 at 20:54

1 Answers1

0

Please refer to SO thread How to use WebRTC + Pubnub Api for video chat client in Native android app

And also, this PubNub demo/tutorial, Doodle with Strangers! Multi-User HTML5 Canvas in 4 Steps might be a more appropriate resource for what you are asking.

Community
  • 1
  • 1
Craig Conover
  • 4,710
  • 34
  • 59