我有自己的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>有人能让插件正常工作吗?如果是的话,我是怎样或错过了什么步骤的?
谢谢
发布于 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.dmg或PluginRTC.exe。
补充说明:
connection.open,而不是调用connection.join。connection.processSdp = function(sdp) {return sdp;};中设置它以防止SDP冲突/错误。https://stackoverflow.com/questions/36002798
复制相似问题