video.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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() {
  38. var videos = $.checkTask.video_id.split(',');
  39. if (curVideo) {
  40. s1 = $.checkTask.start_time.replace(/-/g, "/");
  41. var startTime = new Date(s1).getTime() / 1000;
  42. s1 = $.checkTask.end_time.replace(/-/g, "/");
  43. var endTime = new Date(s1).getTime() / 1000;
  44. //获取当前的index
  45. var index = 0;
  46. for (var i = 0; i < videos.length; i++) {
  47. if (parseInt(videos[i]) == parseInt(curVideo)) {
  48. index = i;
  49. break;
  50. }
  51. }
  52. //获取摄像头信息
  53. VideoGetById(curVideo, function(data) {
  54. if (data != null && typeof(data) != "undefined") {
  55. var pp = {
  56. "videoIds": curVideo,
  57. "cindex": 10,
  58. starttime: startTime,
  59. "endtime": endTime,
  60. "cammercode": data.channel,
  61. "username": data.userName,
  62. "userpwd": data.userPwd,
  63. "v_ip": data.ip,
  64. "v_port": data.port,
  65. };
  66. callFunc("findvideolist", JSON.stringify(pp));
  67. } else {
  68. callFunc("showvideoview", "false");
  69. layer.msg('该处暂无视屏!', {
  70. offset: 'c',
  71. time: 2000, //20s后自动关闭
  72. });
  73. }
  74. }, function(error) {
  75. });
  76. // alert(curVideo);
  77. } else {
  78. }
  79. }
  80. function playVideo(id) {
  81. callFunc("playvideo", id);
  82. }
  83. var maxVV;
  84. function setProcessValue(maxValue) {
  85. //alert(maxValue);
  86. // console.log(max);
  87. maxVV = maxValue;
  88. $("#ex1").slider({ step: 5, min: 0, max: maxValue });
  89. if ($("#full_ex1").length > 0) {
  90. $("#full_ex1").slider({ step: 5, min: 0, max: maxValue });
  91. }
  92. }
  93. var slider_current_value = 0;
  94. function setCurrentProcessValue(value) {
  95. // alert("ddd"+value);
  96. // console.log(value);
  97. var vv = maxVV * (value / 100)
  98. slider_current_value = parseInt(vv);
  99. $("#ex1").slider('setValue', parseInt(vv));
  100. if ($("#full_ex1").length > 0) {
  101. $("#full_ex1").slider('setValue', parseInt(vv));
  102. }
  103. }
  104. function setVideoProcess(value) {
  105. // console.log(value);
  106. var vv = value * 100 / maxVV;
  107. if (!isNaN(vv) && parseInt(vv).toString() != "NaN") {
  108. callFunc("setcurrenplayttime", parseInt(vv));
  109. } else {
  110. }
  111. }
  112. function callFunc(func, param) {
  113. var event = document.createEvent('MessageEvent');
  114. var origin = window.location.protocol + '//' + window.location.host;
  115. event.initMessageEvent(func, true, true, param, origin, 1234, window, null);
  116. document.dispatchEvent(event);
  117. if(jsObj!=undefined){
  118. eval("jsObj."+func+"("+param+")")
  119. }
  120. }
  121. function playNext(index) {
  122. $("#video_list").val(index);
  123. }