I created online education video portal using opentok . Number of students should see the video of teacher. also teacher will see videos of all connected students. with below code i can prevent to subscribe ourself :-
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%';
//}
}
}
I want to prevent students to see other student videos. student's should be able to see teacher's video only.
help will be greatly appreciated. thanks