【问题标题】:rtcmulticonnection safari apple macrtcmulticonnection safari 苹果 mac
【发布时间】:2016-03-15 04:38:34
【问题描述】:

我有自己的 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>

有人能够使插件工作吗? 如果是,我错过了哪些步骤或步骤?

谢谢

【问题讨论】:

    标签: safari webrtc


    【解决方案1】:

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

    【讨论】:

    • 我进行了更新并安装了 safari 插件并应用了 connection.open 和 connection.trickleIce=false *** 但我仍然得到 WebRTC 1.0 (RTCPeerConnection) API 在此浏览器中不可用。查看 Safari 控制台的图片:gyazo.com/ecdb153573600092d42d2903941a2d11
    • 您似乎在使用旧的 rmc3.min.js 请确保它是 3.2.95 或更高版本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-20
    • 1970-01-01
    • 1970-01-01
    • 2021-07-22
    • 2021-06-12
    • 1970-01-01
    • 2017-08-22
    相关资源
    最近更新 更多