video.tpl 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <div id="chat-video-panel">
  2. <div class="row">
  3. <div class="col-md-12">
  4. <h3 class="title"><i class="fa fa-video-camera"></i> {{ room.room_name }} </h3>
  5. </div>
  6. </div>
  7. <div class="row">
  8. <div class="col-md-4">
  9. <div id="chat-local-video"></div>
  10. <div class="username-local">
  11. {% if user_local.user_is_online_in_chat == 1 %}
  12. <img src="{{ 'online.png' | icon(16) }}" />
  13. {% else %}
  14. <img src="{{ 'offline.png' | icon(16) }}" />
  15. {% endif %}
  16. {{ user_local.complete_name }} ( {{ user_local.username }} )
  17. </div>
  18. <div class="chat-friends">
  19. <div class="panel-group" id="blocklistFriends" role="tablist" aria-multiselectable="true">
  20. <div class="panel panel-default">
  21. <div class="panel-heading" role="tab" id="headingOne">
  22. <h4 class="panel-title">
  23. <a role="button" data-toggle="collapse" data-parent="#blocklistFriends" href="#listFriends" aria-expanded="true" aria-controls="listFriends">
  24. {{ "SocialFriend" | get_lang }}
  25. </a>
  26. </h4>
  27. </div>
  28. <div id="listFriends" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
  29. <div class="panel-body">
  30. {{ block_friends }}
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="col-md-8">
  38. <div class="user-from" id="chat-remote-video"></div>
  39. <div class="chat-user-remote">{{ "ChatWithXUser"|get_lang|format(chat_user.complete_name) }}</div>
  40. </div>
  41. </div>
  42. </div>
  43. <script>
  44. (function() {
  45. var VideoChat = {
  46. init: function() {
  47. var isCompatible = !!Modernizr.prefixed('RTCPeerConnection', window);
  48. var notifyNotSupport = function() {
  49. $.get('{{ _p.web_ajax }}chat.ajax.php', {
  50. action: 'notify_not_support',
  51. to: {{ chat_user.id }}
  52. });
  53. };
  54. var startVideoChat = function() {
  55. var webRTC = new SimpleWebRTC({
  56. localVideoEl: 'chat-local-video',
  57. remoteVideosEl: 'chat-remote-video',
  58. autoRequestMedia: true
  59. });
  60. webRTC.on('readyToCall', function() {
  61. webRTC.joinRoom('{{ room_name }}');
  62. });
  63. webRTC.on('videoAdded', function (video, peer) {
  64. $(video).addClass('skip');
  65. });
  66. };
  67. if (!isCompatible) {
  68. notifyNotSupport();
  69. $('#chat-video-panel').remove();
  70. return;
  71. }
  72. $('#messages').remove();
  73. startVideoChat();
  74. }
  75. };
  76. $(document).on('ready', function() {
  77. VideoChat.init();
  78. });
  79. })();
  80. </script>