|
|
@ -56,7 +56,8 @@ var locale = { |
|
|
|
CANT_SUSPEND_OWNER: '', |
|
|
|
CANT_SUSPEND_OWNER: '', |
|
|
|
YOU_HAVE_KICKED_s: '', |
|
|
|
YOU_HAVE_KICKED_s: '', |
|
|
|
CANT_KICK_OWNER: '', |
|
|
|
CANT_KICK_OWNER: '', |
|
|
|
REMOVE_THIS_ADDRESS: '' |
|
|
|
REMOVE_THIS_ADDRESS: '', |
|
|
|
|
|
|
|
DISPLAY_NAME_REQUIRED: '' |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Localize the strings we need
|
|
|
|
// Localize the strings we need
|
|
|
@ -207,6 +208,7 @@ function initVroom(room) { |
|
|
|
role: 'participant' |
|
|
|
role: 'participant' |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
var roomInfo; |
|
|
|
var mainVid = false, |
|
|
|
var mainVid = false, |
|
|
|
chatHistory = {}, |
|
|
|
chatHistory = {}, |
|
|
|
chatIndex = 0, |
|
|
|
chatIndex = 0, |
|
|
@ -238,6 +240,7 @@ function initVroom(room) { |
|
|
|
room: roomName, |
|
|
|
room: roomName, |
|
|
|
id: peers.local.id |
|
|
|
id: peers.local.id |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
async: false, |
|
|
|
error: function(data){ |
|
|
|
error: function(data){ |
|
|
|
$.notify(locale.ERROR_OCCURED, 'error'); |
|
|
|
$.notify(locale.ERROR_OCCURED, 'error'); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -247,6 +250,7 @@ function initVroom(room) { |
|
|
|
webrtc.sendToAll('role_change', {}); |
|
|
|
webrtc.sendToAll('role_change', {}); |
|
|
|
} |
|
|
|
} |
|
|
|
peers.local.role = data.role; |
|
|
|
peers.local.role = data.role; |
|
|
|
|
|
|
|
roomInfo = data; |
|
|
|
// Enable owner reserved menu
|
|
|
|
// Enable owner reserved menu
|
|
|
|
if (data.role == 'owner'){ |
|
|
|
if (data.role == 'owner'){ |
|
|
|
$('.unauthEl').hide(500); |
|
|
|
$('.unauthEl').hide(500); |
|
|
@ -751,6 +755,24 @@ function initVroom(room) { |
|
|
|
getRoomInfo(); |
|
|
|
getRoomInfo(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// askForName set
|
|
|
|
|
|
|
|
webrtc.on('ask_for_name_on', function(data){ |
|
|
|
|
|
|
|
if (peers.local.role != 'owner'){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getRoomInfo(); |
|
|
|
|
|
|
|
$('#askForNameLabel').addClass('btn-danger active'); |
|
|
|
|
|
|
|
$('#askForNameButton').prop('checked', true); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
webrtc.on('ask_for_name_off', function(data){ |
|
|
|
|
|
|
|
if (peers.local.role != 'owner'){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getRoomInfo(); |
|
|
|
|
|
|
|
$('#askForNameLabel').removeClass('btn-danger active'); |
|
|
|
|
|
|
|
$('#askForNameButton').prop('checked', false); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// A few notif on password set/unset or lock/unlock
|
|
|
|
// A few notif on password set/unset or lock/unlock
|
|
|
|
webrtc.on('room_locked', function(data){ |
|
|
|
webrtc.on('room_locked', function(data){ |
|
|
|
$('#lockLabel').addClass('btn-danger active'); |
|
|
|
$('#lockLabel').addClass('btn-danger active'); |
|
|
@ -789,7 +811,12 @@ function initVroom(room) { |
|
|
|
webrtc.once('readyToCall', function () { |
|
|
|
webrtc.once('readyToCall', function () { |
|
|
|
peers.local.id = webrtc.connection.socket.sessionid; |
|
|
|
peers.local.id = webrtc.connection.socket.sessionid; |
|
|
|
getRoomInfo(); |
|
|
|
getRoomInfo(); |
|
|
|
webrtc.joinRoom(room); |
|
|
|
if (roomInfo.ask_for_name && roomInfo.ask_for_name == 'yes'){ |
|
|
|
|
|
|
|
$('#setDisplayName').modal('show'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
webrtc.joinRoom(room); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Handle new video stream added: someone joined the room
|
|
|
|
// Handle new video stream added: someone joined the room
|
|
|
@ -889,6 +916,37 @@ function initVroom(room) { |
|
|
|
updateDisplayName('local'); |
|
|
|
updateDisplayName('local'); |
|
|
|
webrtc.sendDirectlyToAll('vroom', 'setDisplayName', name); |
|
|
|
webrtc.sendDirectlyToAll('vroom', 'setDisplayName', name); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// This is the displayName input before joining the room
|
|
|
|
|
|
|
|
$('#displayNamePre').on('input', function() { |
|
|
|
|
|
|
|
var name = $('#displayNamePre').val(); |
|
|
|
|
|
|
|
if (name.length > 0 && name.length < 50){ |
|
|
|
|
|
|
|
$('#displayNamePreButton').removeClass('disabled'); |
|
|
|
|
|
|
|
$('#displayNamePre').parent().removeClass('has-error'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
$('#displayNamePreButton').addClass('disabled'); |
|
|
|
|
|
|
|
$('#displayNamePre').parent().addClass('has-error'); |
|
|
|
|
|
|
|
if (name.length < 1){ |
|
|
|
|
|
|
|
$('#displayNamePre').notify(locale.DISPLAY_NAME_REQUIRED, 'error'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
$('#displayNamePre').notify(locale.DISPLAY_NAME_TOO_LONG, 'error'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#displayNamePreForm').submit(function(event){ |
|
|
|
|
|
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
var name = $('#displayNamePre').val(); |
|
|
|
|
|
|
|
if (name.length > 0 && name.length < 50){ |
|
|
|
|
|
|
|
$('#setDisplayName').modal('hide'); |
|
|
|
|
|
|
|
$('#displayName').val(name); |
|
|
|
|
|
|
|
peers.local.hasName = true; |
|
|
|
|
|
|
|
peers.local.displayName = name; |
|
|
|
|
|
|
|
updateDisplayName('local'); |
|
|
|
|
|
|
|
webrtc.joinRoom(room); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Handle room lock/unlock
|
|
|
|
// Handle room lock/unlock
|
|
|
|
$('#lockButton').change(function() { |
|
|
|
$('#lockButton').change(function() { |
|
|
@ -937,9 +995,11 @@ function initVroom(room) { |
|
|
|
$.notify(data.msg, 'info'); |
|
|
|
$.notify(data.msg, 'info'); |
|
|
|
if (type === 'set'){ |
|
|
|
if (type === 'set'){ |
|
|
|
$('#askForNameLabel').addClass('btn-danger active'); |
|
|
|
$('#askForNameLabel').addClass('btn-danger active'); |
|
|
|
|
|
|
|
webrtc.sendToAll('ask_for_name_on', {}); |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|
$('#askForNameLabel').removeClass('btn-danger active'); |
|
|
|
$('#askForNameLabel').removeClass('btn-danger active'); |
|
|
|
|
|
|
|
webrtc.sendToAll('ask_for_name_off', {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
else{ |
|
|
|