opentok を使用してオンライン教育ビデオ ポータルを作成しました。生徒の数は、教師のビデオを見る必要があります。また、教師は接続されているすべての生徒のビデオを見ることができます。以下のコードを使用すると、自分自身を購読することを防ぐことができます:-
function subscribeToStreams(streams) {
for (var i = 0; i < streams.length; i++) {
// Make sure we don't subscribe to ourself
if (streams[i].connection.connectionId == session.connection.connectionId) {
return;
}
//if (streams[i].connection.connectionId != session.connection.connectionId) {
// Create the div to put the subscriber element in to
var container = document.getElementById('videoContainer');
var div = document.createElement('div');
var id = 'stream' + streams[i].streamId;
div.setAttribute('id', id);
container.appendChild(div);
// Subscribe to the stream
session.subscribe(streams[i], div.id);
div.style.width = '20%';
div.style.height = '20%';
div.style.left = '80%';
//}
}
}
生徒が他の生徒のビデオを見ないようにしたい。生徒は教師のビデオのみを表示できる必要があります。
助けていただければ幸いです。ありがとう