【问题标题】:WebRTC and screen sharing using PubNub's API?WebRTC 和屏幕共享使用 PubNub 的 API?
【发布时间】:2015-11-12 14:33:16
【问题描述】:

我正在使用 PubNub 的 WebRTC API 进行视频和音频对话,这就像一个魅力。接下来我想在我的应用程序中添加屏幕共享,但我在他们的文档中找不到任何有用的信息,而他们又在几个地方提到了这个选项。

我现在使用的代码:

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');
        }

    }

【问题讨论】:

  • 详情请参阅此 SO 线程,如果您还有其他问题,请告诉我:stackoverflow.com/questions/28740230/…
  • 这个 Codoodler 演示应用程序可能更适合您的要求:pubnub.com/blog/2014-09-03-multiuser-draw-html5-canvas-tutorial
  • @CraigConover 非常感谢,使用 Codedoodler 演示,我现在可以成功分享通过 webkitGetUserMedia() 获得的流;还有一个问题,有没有一种方法可以添加“电话号码”,就像在视频通话示例中那样,我只能在特定用户之间共享流? Ps,请添加您的评论作为答案。
  • WebRTC 演示@webrtc.co 没有提供您需要添加电话号码以连接两个用户的详细信息吗?

标签: video-streaming chat webrtc pubnub screensharing


【解决方案1】:

请参考SO线程How to use WebRTC + Pubnub Api for video chat client in Native android app

此外,这个 PubNub 演示/教程Doodle with Strangers! Multi-User HTML5 Canvas in 4 Steps 可能是更适合您所要求的资源。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    相关资源
    最近更新 更多