首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rtcmulticonnection苹果mac

rtcmulticonnection苹果mac
EN

Stack Overflow用户
提问于 2016-03-15 04:38:34
回答 1查看 1.4K关注 0票数 2

我有自己的rtcmulticonnection服务器启动并运行。

我找到了这个插件https://github.com/muaz-khan/PluginRTC

但这似乎行不通

我得到WebRTC 1.0 (RTCPeerConnection) API在这个浏览器中不可用。

这里我的代码(在chrome和firefox中工作,而不是在safari中工作)

代码语言:javascript
复制
<div id="videos-container"></div>

<script src="js/rmc3.min.js').'"></script>
<script src="js/socket.io.js').'"></script>
<script src="js/Plugin.EveryWhere.js').'"></script>

<script>  

var connection = new RTCMultiConnection();
connection.socketURL = "https://__MyDomain.com:9000/";
var roomid = "main_room";

connection.session = {
    audio: true,
    video: true
};

connection.sdpConstraints.mandatory = {
    OfferToReceiveAudio: true,
    OfferToReceiveVideo: true
};

var videosContainer = document.getElementById("videos-container");
connection.onstream = function(event) {
    videosContainer.appendChild(event.mediaElement);
    setTimeout(function() { event.mediaElement.play();  }, 5000);
};

connection.openOrJoin(roomid);

// *** Plugin.EveryWhere.js [BEGIN]
var Plugin = {};
window.onPluginRTCInitialized = function(pluginRTCObject) {
    Plugin = pluginRTCObject;
    MediaStreamTrack      = Plugin.MediaStreamTrack;
    RTCPeerConnection     = Plugin.RTCPeerConnection;
    RTCIceCandidate       = Plugin.RTCIceCandidate;
    RTCSessionDescription = Plugin.RTCSessionDescription;
};
if (!!window.PluginRTC) window.onPluginRTCInitialized(window.PluginRTC);

connection.onaddstream = function(event) {
    if (isPluginRTC) {
        var mediaElement = document.createElement("videos-container");

        var body = (document.body || document.documentElement);
        body.insertBefore(mediaElement, body.firstChild);

        setTimeout(function() {
            Plugin.attachMediaStream(mediaElement, event.stream);

            // here you can append "mediaElement" to specific container
            // specificContainer.appendChild(mediaElement);
        }, 3000);
    } else {
        // do chrome/Firefox relevant stuff with "event.stream"
    }
};
// *** Plugin.EveryWhere.js [END]

</script>

有人能让插件正常工作吗?如果是的话,我是怎样或错过了什么步骤的?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2016-03-16 06:53:14

RTCMultiConnection-v3.2.95 现在支持 IE/Safari:

若要支持Safari/IE,请修改Gruntfile.js#L30以启用dev/Plugin.EveryWhere.js

然后,不要忘记调用grunt来重新编译代码。

现在,在HTML文件中设置connection.trickleIce=false。现在,视频会议/聊天/等等将在chrome/firefox/safari/IE之间工作。

请安装PluginRTC.dmgPluginRTC.exe

补充说明:

  1. 您必须启动Safari/IE的调用,因为当前Safari/IE无法创建答案。也就是说,IE/Safari必须调用connection.open,而不是调用connection.join
  2. 在HTML:connection.processSdp = function(sdp) {return sdp;};中设置它以防止SDP冲突/错误。
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36002798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档