Notify others if we don't have a webcam

In which case, add a grey glyphicon in the preview
Also disable suspend buttons
master
Daniel Berteaud 11 years ago
parent 4c53aa5117
commit 1f2b112b3c
  1. 12
      public/css/vroom.css
  2. 25
      public/js/vroom.js
  3. 19
      templates/default/join.html.ep

@ -67,6 +67,18 @@
font-size: 2em; font-size: 2em;
content: "\e124"; content: "\e124";
} }
.noWebcam{
position: absolute;
top: 10%;
left: 50%;
margin-left: -25px;
}
.noWebcam:before{
font-family: 'Glyphicons Halflings';
color: grey;
font-size: 4em;
content: "\e008";
}
.displayName { .displayName {
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;

@ -311,7 +311,8 @@ function initVroom(room) {
videoPaused: false, videoPaused: false,
displayName: '', displayName: '',
color: chooseColor(), color: chooseColor(),
role: 'participant' role: 'participant',
hasVideo: true
} }
}; };
var roomInfo; var roomInfo;
@ -582,6 +583,7 @@ function initVroom(room) {
color: color, color: color,
micMuted: false, micMuted: false,
videoPaused: false, videoPaused: false,
hasVideo: true,
dc: peer.getDataChannel('vroom'), dc: peer.getDataChannel('vroom'),
obj: peer obj: peer
}; };
@ -595,6 +597,8 @@ function initVroom(room) {
} }
// color can be sent through the signaling channel // color can be sent through the signaling channel
peer.send('peer_color', {color: peers.local.color}); peer.send('peer_color', {color: peers.local.color});
// if we don't have a video, just signal it to this peer
peer.send('media_info', {video: !!videoConstraints});
// We don't have chat history yet ? Lets ask to this new peer // We don't have chat history yet ? Lets ask to this new peer
if(!peers.local.hasHistory && chatIndex == 0){ if(!peers.local.hasHistory && chatIndex == 0){
peer.sendDirectly('vroom', 'getHistory', ''); peer.sendDirectly('vroom', 'getHistory', '');
@ -893,6 +897,15 @@ function initVroom(room) {
} }
}); });
// This peer indicates he has no webcam
webrtc.on('media_info', function(data){
if (!data.payload.video){
$('#overlay_' + data.id).append('<div id="noWebcam_' + data.id + '" class="noWebcam"></div>');
$('#actionPause_' + data.id).addClass('disabled');
peers[data.id].hasVideo = false;
}
});
// An owner has just promoted a participant of the room to the owner role // An owner has just promoted a participant of the room to the owner role
webrtc.on('owner_promoted', function(data){ webrtc.on('owner_promoted', function(data){
if (peers[data.id].role != 'owner' || data.roomType == 'screen'){ if (peers[data.id].role != 'owner' || data.roomType == 'screen'){
@ -1478,6 +1491,12 @@ function initVroom(room) {
} }
}); });
// Disable suspend webcam button if no webcam
if (!videoConstraints){
$('#suspendCamButton').attr('disabled', true);
$('#suspendCamLabel').addClass('disabled');
}
// Suspend the webcam // Suspend the webcam
$('#suspendCamButton').change(function() { $('#suspendCamButton').change(function() {
var action = ($(this).is(':checked')) ? 'pause':'resume'; var action = ($(this).is(':checked')) ? 'pause':'resume';
@ -1512,7 +1531,7 @@ function initVroom(room) {
// Suspend all the peers // Suspend all the peers
$('#suspendEveryoneButton').click(function(){ $('#suspendEveryoneButton').click(function(){
$.each(peers, function(id){ $.each(peers, function(id){
if (id != 'local'){ if (id != 'local' && peers[id].hasVideo){
pausePeer(id, 'pause'); pausePeer(id, 'pause');
} }
}); });
@ -1520,7 +1539,7 @@ function initVroom(room) {
// Resum all the peers // Resum all the peers
$('#resumeEveryoneButton').click(function(){ $('#resumeEveryoneButton').click(function(){
$.each(peers, function(id){ $.each(peers, function(id){
if (id != 'local'){ if (id != 'local' && peers[id].hasVideo){
pausePeer(id, 'resume'); pausePeer(id, 'resume');
} }
}); });

@ -754,6 +754,15 @@
var roomName = '<%= $room %>'; var roomName = '<%= $room %>';
$( document ).ready(function() { $( document ).ready(function() {
setTimeout(function(){ setTimeout(function(){
<% if ($video eq 'false'){ %>
videoConstraints = false;
<% } else{ %>
videoConstraints = {
mandatory: {
maxFrameRate: 15,
}
};
<% } %>
webrtc = new SimpleWebRTC({ webrtc = new SimpleWebRTC({
url: "<%= $config->{signalingServer} %>", url: "<%= $config->{signalingServer} %>",
peerConnectionConfig: { peerConnectionConfig: {
@ -774,15 +783,7 @@
threshold: -20 threshold: -20
}, },
media: { media: {
<% if ($video eq 'false'){ %> video: videoConstraints,
video: false,
<% } else{ %>
video: {
mandatory: {
maxFrameRate: 15,
}
},
<% } %>
audio: true audio: true
} }
}); });

Loading…
Cancel
Save