|
|
@ -1,5 +1,5 @@ |
|
|
|
<p class="lead">{{ "ChatWithXUser"|get_lang|format(chat_user.complete_name) }}</p> |
|
|
|
<p class="lead">{{ "ChatWithXUser"|get_lang|format(chat_user.complete_name) }}</p> |
|
|
|
<div class="row"> |
|
|
|
<div class="row" id="chat-video-panel"> |
|
|
|
<div class="col-sm-3"> |
|
|
|
<div class="col-sm-3"> |
|
|
|
<div class="thumbnail"> |
|
|
|
<div class="thumbnail"> |
|
|
|
<video id="chat-local-video" class="skip"></video> |
|
|
|
<video id="chat-local-video" class="skip"></video> |
|
|
@ -12,17 +12,47 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
(function() { |
|
|
|
(function() { |
|
|
|
var webRTC = new SimpleWebRTC({ |
|
|
|
var VideoChat = { |
|
|
|
localVideoEl: 'chat-local-video', |
|
|
|
init: function() { |
|
|
|
remoteVideosEl: 'chat-remote-video', |
|
|
|
var isCompatible = !!Modernizr.prefixed('RTCPeerConnection', window); |
|
|
|
autoRequestMedia: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webRTC.on('readyToCall', function() { |
|
|
|
var notifyNotSupport = function() { |
|
|
|
webRTC.joinRoom('{{ room_name }}'); |
|
|
|
$.get('{{ _p.web_ajax }}chat.ajax.php', { |
|
|
|
}); |
|
|
|
action: 'notify_not_support', |
|
|
|
webRTC.on('videoAdded', function (video, peer) { |
|
|
|
to: {{ chat_user.id }} |
|
|
|
$(video).addClass('skip'); |
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var startVideoChat = function() { |
|
|
|
|
|
|
|
var webRTC = new SimpleWebRTC({ |
|
|
|
|
|
|
|
localVideoEl: 'chat-local-video', |
|
|
|
|
|
|
|
remoteVideosEl: 'chat-remote-video', |
|
|
|
|
|
|
|
autoRequestMedia: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webRTC.on('readyToCall', function() { |
|
|
|
|
|
|
|
webRTC.joinRoom('{{ room_name }}'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
webRTC.on('videoAdded', function (video, peer) { |
|
|
|
|
|
|
|
$(video).addClass('skip'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isCompatible) { |
|
|
|
|
|
|
|
notifyNotSupport(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#chat-video-panel').remove(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#messages').remove(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startVideoChat(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).on('ready', function() { |
|
|
|
|
|
|
|
VideoChat.init(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|