video.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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 queryVideoLists(videoIds) {
  38. console.log(videoIds);
  39. if (CLIENTVERSION == 1 && ISCLIENT) {
  40. callFunc("showvideoview", "false");
  41. layer.msg('该软件版本太低,请升级!', {
  42. offset: 'r',
  43. time: 5000, //20s后自动关闭
  44. });
  45. return;
  46. }
  47. if (videoIds != null) {
  48. s1 = $.checkTask.start_time.replace(/-/g, "/");
  49. var startTime = new Date(s1).getTime() / 1000;
  50. s1 = $.checkTask.end_time.replace(/-/g, "/");
  51. var endTime = new Date(s1).getTime() / 1000;
  52. VideoGetByIds(videoIds, function(data) {
  53. var video_type = 1;
  54. if(data[0].user_name != "undefined" && data[0].user_name != null){
  55. video_type = 2;
  56. }
  57. if(video_type == 2){
  58. curVideo = data.channel;
  59. }
  60. var cammercode = new Array();
  61. var username = new Array();
  62. var userpwd = new Array();
  63. var v_ip = new Array();
  64. var v_port = new Array();
  65. if(video_type == 2){
  66. for(var index in data){
  67. var videoObj = data[index];
  68. cammercode.push(videoObj.channel);
  69. username.push(videoObj.user_name);
  70. userpwd.push(videoObj.user_pwd);
  71. v_ip.push(videoObj.ip);
  72. v_port.push(videoObj.port);
  73. }
  74. videoIds = cammercode.toString();
  75. }else{
  76. v_port.push(0);
  77. }
  78. if (data != null && typeof(data) != "undefined") {
  79. var pp = {
  80. "videoIds": videoIds,
  81. "cindex": 1,
  82. "starttime": startTime,
  83. "endtime": endTime,
  84. "cammercode": cammercode.toString(),
  85. // "username": username.toString(),
  86. // "userpwd": userpwd.toString(),
  87. // "v_ip": v_ip.toString(),
  88. "video_type":video_type,
  89. // "v_port": v_port.toString(),
  90. "videos": []
  91. };
  92. data.forEach(came => {
  93. pp.videos.push({
  94. "videoId": came.device_id,
  95. "cametype": came.cameratype,
  96. "filetype": came.playtype,
  97. "cammercode": came.channel,
  98. "username": came.user_name,
  99. "userpwd": came.user_pwd,
  100. "v_ip": came.ip,
  101. "video_type":video_type,
  102. "v_port": came.port
  103. });
  104. });
  105. console.log(pp);
  106. callFunc("findvideolist", JSON.stringify(pp));
  107. } else {
  108. callFunc("showvideoview", "false");
  109. layer.msg('该处暂无视屏!', {
  110. offset: 'c',
  111. time: 2000, //20s后自动关闭
  112. });
  113. }
  114. }, function(error) {});
  115. }
  116. }
  117. function queryVideoList() {
  118. var videos = $.checkTask.video_id.split(',');
  119. if (curVideo) {
  120. s1 = $.checkTask.start_time.replace(/-/g, "/");
  121. var startTime = new Date(s1).getTime() / 1000;
  122. s1 = $.checkTask.end_time.replace(/-/g, "/");
  123. var endTime = new Date(s1).getTime() / 1000;
  124. //获取当前的index
  125. var index = 0;
  126. for (var i = 0; i < videos.length; i++) {
  127. if (parseInt(videos[i]) == parseInt(curVideo)) {
  128. index = i;
  129. break;
  130. }
  131. }
  132. debugger
  133. //获取摄像头信息
  134. VideoGetById(curVideo, function(data) {
  135. console.log(data);
  136. if (data != null && typeof(data) != "undefined") {
  137. var video_type = 1;
  138. var str = curVideo + '|' + startTime + '|' + endTime + '|' + data.cameratype + '|' + data.playtype + '|' + index;
  139. if(typeof(data.user_name) != "undefined" && typeof(data.user_name) != null){
  140. video_type = 2;
  141. }
  142. if(video_type == 2){
  143. curVideo = data.channel;
  144. }
  145. var pp = {
  146. "videoIds": curVideo,
  147. "cindex": 10,
  148. starttime: startTime,
  149. "endtime": endTime,
  150. "cammercode": data.channel,
  151. "username": data.user_name,
  152. "userpwd": data.user_pwd,
  153. "v_ip": data.ip,
  154. "video_type":video_type,
  155. "v_port": data.port,
  156. "videos": [{
  157. "videoId": curVideo,
  158. "cametype": data.cameratype,
  159. "filetype": data.playtype,
  160. "cammercode": data.channel,
  161. "username": data.user_name,
  162. "userpwd": data.user_pwd,
  163. "v_ip": data.ip,
  164. "video_type":video_type,
  165. "v_port": data.port
  166. }]
  167. };
  168. if (CLIENTVERSION == 1) {
  169. callFunc("findvideolist", str);
  170. } else {
  171. callFunc("findvideolist", JSON.stringify(pp));
  172. }
  173. } else {
  174. callFunc("showvideoview", "false");
  175. layer.msg('该处暂无视屏!', {
  176. offset: 'c',
  177. time: 2000, //20s后自动关闭
  178. });
  179. }
  180. }, function(error) {
  181. });
  182. // alert(curVideo);
  183. } else {
  184. }
  185. }
  186. function playVideo(id) {
  187. callFunc("playvideo", id);
  188. }
  189. var maxVV;
  190. function setProcessValue(maxValue) {
  191. //alert(maxValue);
  192. // console.log(max);
  193. maxVV = maxValue;
  194. $("#ex1").slider({ step: 5, min: 0, max: maxValue });
  195. if ($("#full_ex1").length > 0) {
  196. $("#full_ex1").slider({ step: 5, min: 0, max: maxValue });
  197. }
  198. }
  199. var slider_current_value = 0;
  200. function setCurrentProcessValue(value) {
  201. // alert("ddd"+value);
  202. // console.log(value);
  203. var vv = maxVV * (value / 100)
  204. slider_current_value = parseInt(vv);
  205. $("#ex1").slider('setValue', parseInt(vv));
  206. if ($("#full_ex1").length > 0) {
  207. $("#full_ex1").slider('setValue', parseInt(vv));
  208. }
  209. }
  210. function setVideoProcess(value) {
  211. // console.log(value);
  212. var vv = value * 100 / maxVV;
  213. if (!isNaN(vv) && parseInt(vv).toString() != "NaN") {
  214. callFunc("setcurrenplayttime", parseInt(vv));
  215. } else {
  216. }
  217. }
  218. function callFunc(func, param) {
  219. var event = document.createEvent('MessageEvent');
  220. var origin = window.location.protocol + '//' + window.location.host;
  221. event.initMessageEvent(func, true, true, param, origin, 1234, window, null);
  222. document.dispatchEvent(event);
  223. }
  224. function playNext(index) {
  225. $("#video_list").val(index);
  226. }