我从socket.io服务器收到以下错误。
“运输未知”
你能告诉我为什么会出现这个错误吗?
我使用此信令服务器Connection.socketURL ='https://rtcmulticonnection.herokuapp.com:443/';
我的代码以前曾经工作但突然停止了工作。
使用此库实现webRTC http://www.rtcmulticonnection.org/docs/
任何人都可以帮我吗?
以下是我的代码
<script src="https://cdn.webrtc-experiment.com:443/rmc3.min.js"></script>
<script type="text/javascript">
var Connection = new RTCMultiConnection();
// or a free signaling server
Connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';
Connection.session = {
data: true,
audio: true,
};
Connection.sdpConstraints.mandatory = {
OfferToReceiveAudio: true,
OfferToReceiveVideo: true
};
localvideoContainer = document.getElementById('meeting-preview');
remotevideoContainer = document.getElementById('attendee-xylon');
Connection.onstream = function(event){
var video = event.mediaElement;
console.log(event);
if (event.type === 'local') {
var userinfoDIV = document.createElement('div');
userinfoDIV.className = 'user-video';
userinfoDIV.innerHTML = '<video id="' + event.userid + '" src="' + URL.createObjectURL(event.stream) + '" autoplay muted=true volume=0></vide>' || '<img src="/frontend/images/meeting-preview.png" class="img-responsive" />';
localvideoContainer.appendChild(userinfoDIV);
};
if (event.type === 'remote') {
var userinfoDIV = document.createElement('div');
userinfoDIV.id = event.userid;
userinfoDIV.className = 'user-video meeting-attendees-content timer-icon';
userinfoDIV.innerHTML = '<div id="remote"><video id="' + event.userid + '" src="' + URL.createObjectURL(event.stream) + '" autoplay muted=true volume=0></vide></div><button class="btn btn-custom" type="button" data-toggle="collapse" data-target="#collapse-one" aria-expanded="false" aria-controls="collapse-one">Show Goals / Progress</button><div class="collapse" id="collapse-one"><div class="well attendees-moreinfo"><div class="row"><div class="col-lg-12"><div class="personality-label week-goal"><span>1.</span> Here comes my defined goal for the week</div><div class="personality-bar"><div class="goal-bar-wrap"><div class="meter goal-progress nostripes"><span style="width: 66px; height: 4px;"></span></div></div></div><div class="personality-percentage text-right"><p>66%</p><p></p></div></div></div><div class="row"><div class="col-lg-12"><div class="personality-label week-goal"><span>2.</span> Here comes my defined goal for the week</div><div class="personality-bar"><div class="goal-bar-wrap"><div class="meter goal-progress nostripes"><span style="width: 50px; height: 4px;"></span></div></div></div><div class="personality-percentage text-right"><p>50%</p><p></p></div></div></div><div class="row"><div class="col-lg-12"><div class="personality-label week-goal"><span>3.</span> Here comes my defined goal for the week</div><div class="personality-bar"><div class="goal-bar-wrap"><div class="meter goal-progress nostripes"><span style="width: 80px; height: 4px;"></span></div></div></div><div class="personality-percentage text-right"><p>80%</p><p></p></div></div></div></div></div>' || '<img src="/frontend/images/meeting-preview.png" class="img-responsive" />';
remotevideoContainer.appendChild(userinfoDIV);
};
}
Connection.onclose = Connection.onleave = function(event) {
console.log(event);
$('#'+event.userid).hide();
};
</script>
<script type="text/javascript">
$(document).ready(function(){
var url = window.location.pathname;
Connection.openOrJoin(url.replace('/meetings/joinMeeting/',"") || 'predefined-roomid');
});
</script>
答案 0 :(得分:1)
请检查:
最近发布的版本正在使用最新的socket.io.js,因此您要求使用以下文件:
<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>
请不要使用rmc3.min.js
。