I am creating Audio/Video/Text chat application. I have successfully completed Video conferencing functionality. But I don't have any idea about accessing User's webcam without user's permission.
What exactly I want to do is Admin can access user's webcam. I have created online user's list. When admin click on a button Watch
of online user, admin should be able to access user's webcam, So that admin can see from that particular user's webcam.
Can any one guide me to do that?
Super admin can see all rooms, get video from any user from any room.
You can use socket.io or otherwise PHP/mySQL to share rooms with the super-admin.
A super admin can view any user's video using "join" method:
var selectedUserId = database.getSelectedUserId();
connection.join(selectedUserId);
Super admin must set "dontCaptureUserMedia=true" to make sure he don't share his own camera. Which means that super-admin will seemlessly view videos from any user from any room.
connection.dontCaptureUserMedia = true;
var selectedUserId = database.getSelectedUserId();
connection.join(selectedUserId);
See how to send or receive custom messages using socket.io and try a demo as well.
Here is an example code for super admin:
connection.socketCustomEvent = 'super-admin-socket';
connection.dontCaptureUserMedia = true;
connection.connectSocket(function() {
connection.socket.on(connection.socketCustomEvent, function(message) {
if (message.newUser === true) {
connection.join(message.userid);
}
});
});
Here is code for all normal users. i.e. any user from any room:
connection.socketCustomEvent = 'super-admin-socket';
connection.openOrJoin('any-room-id', function() {
// this message is going toward super-admin
// super-admin will receive this message
// super-admin can view this user's camera seamlessly
// or show his name in a list
connection.socket.emit(connection.socketCustomEvent, {
newUser: true,
userid: connection.userid
});
});
See how to share rooms with super admin:
Following code is for normal users:
connection.socketCustomEvent = 'super-admin-socket';
connection.openOrJoin('any-room-id', function() {
// check if it is a room owner
if (connection.isInitiator === true) {
// room owner is sharing his room with super-adin
connection.socket.emit(connection.socketCustomEvent, {
newRoom: true,
roomid: connection.sessionid
});
}
});
Following code is for super admin:
connection.socketCustomEvent = 'super-admin-socket';
connection.dontCaptureUserMedia = true;
connection.connectSocket(function() {
connection.socket.on(connection.socketCustomEvent, function(message) {
if (message.newUser === true) {
connection.join(message.userid);
}
if (message.newRoom === true) {
// display room in a list
// or view room owner's video
connection.join(message.roomid);
}
});
});
Conclusion:
Super admin must have
userid
from any user to view his video.