में शामिल होने तक मैं उपयोगकर्ता को शामिल होने का इंतजार कैसे करूंगा, मैं एक वीडियो कॉन्फ़्रेंस रूम लागू कर रहा हूं जिसमें कोई उपयोगकर्ता वीडियो कॉन्फ़्रेंस बना सकता है और अन्य उपयोगकर्ताओं को आमंत्रित कर सकता है।मीटिंग आयोजक पहले
अब मैं यह सुनिश्चित करना चाहता हूं कि जब तक मीटिंग आयोजक कमरे खोलता है तब तक उपयोगकर्ता सम्मेलन में शामिल नहीं हो सकता।
मेरे पास निम्न कोड है लेकिन यह काम नहीं कर रहा है। बैठक आयोजक कमरे खोल सकता है लेकिन जब उपयोगकर्ता "सम्मेलन में शामिल होने" पर क्लिक करते हैं तो इसमें शामिल नहीं होता है।
// https://github.com/muaz-khan/RTCMultiConnection
var rmc = new RTCMultiConnection();
rmc.userid = "<?php echo $user->fname . ' ' . $user->lname . ' (' . $user->username . ')' ; ?>";
rmc.session = {
video: true,
audio: true,
data: true
};
var room_status = 0; //room closed
$('#open-room').click(function() {
// http://www.rtcmulticonnection.org/docs/open/
room_status = 1; //room opened
rmc.open();
rmc.streams.mute({video : true});
document.getElementById("on-off-video").style.color= 'red';
});
$('#join-room').click(function() {
if(room_status == 1) {
// http://www.rtcmulticonnection.org/docs/connect/
rmc.connect();
rmc.streams.mute({video: true});
document.getElementById("on-off-video").style.color= 'red';
}
console.log("Waiting for meeting organizer");
});
// display a notification box
window.addEventListener('beforeunload', function() {
return 'Do you want to leave?';
}, false);
// leave here
window.addEventListener('unload', function() {
rmc.leave();
}, false);
rmc.onMediaCaptured = function() {
$('#share-screen').removeAttr('disabled');
$('#open-room').attr('disabled', 'disabled');
$('#join-room').attr('disabled', 'disabled');
};
//chat
rmc.onopen = function (event) {
//alert('Text chat has been opened between you and ' + event.userid);
document.getElementById('input-text-chat').disabled = false;
room_status = 1;
};
//end of chat
$('#disconnect').click(function() {
room_status = 0; //room closed
rmc.leave();
setTimeout("location.href = '../';",2000);
});
//to know the stream type
rmc.onstream = function (e) {
if (e.type == 'local') {
// alert("the stream is local");
}
if (e.type == 'remote') {
// alert("the stream is remote");
}
if (e.isVideo) {
var uibox = document.createElement("div");
uibox.appendChild(document.createTextNode(e.userid));
uibox.className = "userid";
uibox.id = "uibox-" + e.userid.replace(/ |\(|\)/g, '');
document.getElementById('video-container').appendChild(e.mediaElement);
document.getElementById('video-container').appendChild(uibox);
}
else if (e.isAudio) {
document.getElementById('video-container').appendChild(e.mediaElement);
}
else if (e.isScreen) {
$('#cotools-panel iframe').hide();
$('#cotools-panel video').remove();
document.getElementById('cotools-panel').appendChild(e.mediaElement);
}
};
//removes the div containing the userid of the user who is leaving
rmc.onleave = function (e) {
$('#' + "uibox-" + e.userid.replace(/ |\(|\)/g, '')).remove();
};
ऐसा लगता है कि room_status $ ('# join-room') के दायरे में नहीं है। इसे वैश्विक बनाने या इसे संदेश भेजने पर विचार करें। –
रुको, वह बेवकूफ था। आप var के साथ घोषित नहीं कर रहे हैं इसलिए यह वैश्विक है। मुझे इसे और अधिक विचार देने की आवश्यकता होगी। –
क्या आप इसे हमेशा कंसोल नंबर में प्राप्त कर रहे हैं? ("आयोजक से मिलने की प्रतीक्षा"); आपको सभी ब्राउज़रों को सूचित करना चाहिए कि रूम_स्टैटस के लिए मान 1 के बराबर है जब कोई कमरा खोलता है। (सभी ब्राउज़रों को एक संदेश उत्सर्जित करें अन्यथा प्रत्येक ब्राउज़र के लिए मूल्य हमेशा 0 होगा)। – ecarrizo