video.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. function setProgress(percent) {
  2. $('input[type="range"]').val(percent).change();
  3. }
  4. function doAction(func) {
  5. if (func.indexOf("video") != -1) {
  6. if (func.indexOf("start") != -1) {
  7. $("#video_btn_start").addClass("hidden");
  8. $("#video_btn_stop").removeClass("hidden");
  9. if ($("#full_video_btn_start").length > 0) {
  10. $("#full_video_btn_start").addClass("hidden");
  11. $("#full_video_btn_stop").removeClass("hidden");
  12. }
  13. }
  14. if (func.indexOf("stop") != -1) {
  15. $("#video_btn_start").removeClass("hidden");
  16. $("#video_btn_stop").addClass("hidden");
  17. if ($("#full_video_btn_start").length > 0) {
  18. $("#full_video_btn_stop").addClass("hidden");
  19. $("#full_video_btn_start").removeClass("hidden");
  20. }
  21. }
  22. callFunc(func, '');
  23. } else {
  24. callFunc(func, '');
  25. }
  26. }
  27. function setVideoPos() {
  28. var pos = $("#video_pos").val();
  29. if ($("#full_video_pos").length > 0) {
  30. pos = $("#full_video_pos").val();
  31. }
  32. if (/^(\+|-)?\d+($|\.\d+$)/.test(pos)) {
  33. slider_current_value = pos;
  34. callFunc("video_pos", pos);
  35. }
  36. }
  37. function queryVideoList(videoIds) {
  38. if (videoIds != null) {
  39. s1 = $.checkTask.start_time.replace(/-/g, "/");
  40. var startTime = new Date(s1).getTime() / 1000;
  41. s1 = $.checkTask.end_time.replace(/-/g, "/");
  42. var endTime = new Date(s1).getTime() / 1000;
  43. VideoGetByIds(videoIds, function(data) {
  44. if (data != null && typeof(data) != "undefined") {
  45. var pp = {
  46. "videoIds": videoIds,
  47. "cindex": 10,
  48. starttime: startTime,
  49. "endtime": endTime,
  50. "videos": []
  51. };
  52. data.forEach(came => {
  53. pp.videos.push({
  54. "videoId": came.id,
  55. "cametype": came.cameratype,
  56. "filetype": came.playtype
  57. });
  58. });
  59. var pp = {
  60. "videoIds": videoIds,
  61. "cindex": 1,
  62. starttime: startTime,
  63. "endtime": endTime,
  64. "videos": [{
  65. "videoId": curVideo,
  66. "cametype": data.cameratype,
  67. "filetype": data.playtype
  68. }]
  69. };
  70. callFunc("findvideolist", JSON.stringify(pp));
  71. }
  72. }, function(error) {});
  73. }
  74. }
  75. function queryVideoList() {
  76. var videos = $.checkTask.video_id.split(',');
  77. if (curVideo) {
  78. s1 = $.checkTask.start_time.replace(/-/g, "/");
  79. var startTime = new Date(s1).getTime() / 1000;
  80. s1 = $.checkTask.end_time.replace(/-/g, "/");
  81. var endTime = new Date(s1).getTime() / 1000;
  82. //获取当前的index
  83. var index = 0;
  84. for (var i = 0; i < videos.length; i++) {
  85. if (parseInt(videos[i]) == parseInt(curVideo)) {
  86. index = i;
  87. break;
  88. }
  89. }
  90. //获取摄像头信息
  91. VideoGetById(curVideo, function(data) {
  92. if (data != null && typeof(data) != "undefined") {
  93. var str = curVideo + '|' + startTime + '|' + endTime + '|' + data.cameratype + '|' + data.playtype + '|' + index;
  94. var pp = {
  95. "videoIds": curVideo,
  96. "cindex": 10,
  97. starttime: startTime,
  98. "endtime": endTime,
  99. "videos": [{
  100. "videoId": curVideo,
  101. "cametype": data.cameratype,
  102. "filetype": data.playtype
  103. }]
  104. };
  105. callFunc("findvideolist", JSON.stringify(pp));
  106. }
  107. }, function(error) {
  108. });
  109. // alert(curVideo);
  110. } else {
  111. }
  112. }
  113. function playVideo(id) {
  114. callFunc("playvideo", id);
  115. }
  116. var maxVV;
  117. function setProcessValue(maxValue) {
  118. //alert(maxValue);
  119. // console.log(max);
  120. maxVV = maxValue;
  121. $("#ex1").slider({ step: 5, min: 0, max: maxValue });
  122. if ($("#full_ex1").length > 0) {
  123. $("#full_ex1").slider({ step: 5, min: 0, max: maxValue });
  124. }
  125. }
  126. var slider_current_value = 0;
  127. function setCurrentProcessValue(value) {
  128. // alert("ddd"+value);
  129. // console.log(value);
  130. var vv = maxVV * (value / 100)
  131. slider_current_value = parseInt(vv);
  132. $("#ex1").slider('setValue', parseInt(vv));
  133. if ($("#full_ex1").length > 0) {
  134. $("#full_ex1").slider('setValue', parseInt(vv));
  135. }
  136. }
  137. function setVideoProcess(value) {
  138. // console.log(value);
  139. var vv = value * 100 / maxVV;
  140. if (!isNaN(vv) && parseInt(vv).toString() != "NaN") {
  141. callFunc("setcurrenplayttime", parseInt(vv));
  142. } else {
  143. }
  144. }
  145. function callFunc(func, param) {
  146. var event = document.createEvent('MessageEvent');
  147. var origin = window.location.protocol + '//' + window.location.host;
  148. event.initMessageEvent(func, true, true, param, origin, 1234, window, null);
  149. document.dispatchEvent(event);
  150. }
  151. function playNext(index) {
  152. $("#video_list").val(index);
  153. }