rtcmulticonnection safari apple mac

时间:2016-03-15 04:38:35

标签: safari webrtc

我已经启动并运行了自己的rtcmulticonnection服务器

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

但它似乎不起作用

  

我得到的WebRTC 1.0(RTCPeerConnection)API不可用   浏览器。

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

<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>

是否有人能够使插件正常工作? 如果是,我错过了怎样或者哪一步?

由于

1 个答案:

答案 0 :(得分:2)

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冲突/错误。