nonLiveStreaming_shexiangtou.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <style type="text/css">
  7. #container {
  8. width: 50%;
  9. height:500px;
  10. margin-left:10px;
  11. margin: 20px auto;
  12. z-index: -1;
  13. }
  14. button{
  15. background-color: #008CBA;
  16. color: white;
  17. margin-left:10px;
  18. border: none;
  19. }
  20. </style>
  21. <link rel="stylesheet" href="../../../../public/layui/css/layui.css">
  22. </head>
  23. <body>
  24. <script type="text/javascript" src="../../../../public/kmedia/kmedia.js"></script>
  25. <script src="../../../../public/layui/layui.js"></script>
  26. <div id="container">
  27. <div style="margin:1px">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称:摄像头名称</div>
  28. <br/>
  29. <div style="margin:1px">位&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;置:摄像头位置名称</div>
  30. <br/>
  31. <div style="margin:1px">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:123456678</div>
  32. <br/>
  33. <div style="margin:1px">所属机构:海口市xxx公安局</div>
  34. <br/>
  35. <div style="margin:1px"><table><tr><td>时间选择:</td><td><input type="text" class="layui-input" id="startDate" style="width:200px"></td><td>&nbsp;&nbsp;至&nbsp;&nbsp;</td><td><input type="text" class="layui-input" id="endDate" style="width:200px"></td><td>&nbsp;&nbsp;&nbsp;&nbsp;<button id="searchbtn" type="button" class="layui-btn" onclick="searchVedio()">查询</button></td></tr></table></div>
  36. <br/>
  37. </div>
  38. <script>
  39. layui.use('laydate', function(){
  40. var laydate = layui.laydate;
  41. //执行一个laydate实例
  42. laydate.render({
  43. elem: '#startDate' //指定元素
  44. ,type: 'datetime'
  45. });
  46. //执行一个laydate实例
  47. laydate.render({
  48. elem: '#endDate' //指定元素
  49. ,type: 'datetime'
  50. });
  51. });
  52. </script>
  53. </body>
  54. <script>
  55. 'use strict';
  56. var kmedia = new KMedia({
  57. selector: '#container',
  58. mediaUrl: './static/demo.mp4',
  59. mediaType: 'video',
  60. // serviceUrl: './config.json',
  61. // 注意播放类型修改为实时流模式
  62. // playType: 'liveStreaming',
  63. playType: 'nonLiveStreaming',
  64. // playType: 'file',
  65. progressDisplayTime: false,
  66. // fileEncrypt: 'aes128',
  67. theme: 'blue',
  68. autoplay: true,
  69. restore: true,
  70. tools: ['play', 'volume', 'requestFullscreen'],
  71. loading: {
  72. beforeStream: '初始化中',
  73. beforePicture: '视频加载中',
  74. timeout: '视频加载已超时'
  75. },
  76. mediaInfo: {
  77. file: {
  78. },
  79. liveStreaming: {
  80. },
  81. nonLiveStreaming: {
  82. websocketUrl: 'wss://59.212.10.159',
  83. devId: '46902461001321000003',
  84. startTime: '2020-04-21 13:00:00',
  85. endTime: '2020-04-21 14:00:00'
  86. }
  87. },
  88. onload: function () {
  89. }
  90. });
  91. function searchVedio(){
  92. if(document.getElementById("startDate").value == '' || document.getElementById("endDate").value == ''){
  93. alert('查询日期不能为空!')
  94. return;
  95. }
  96. var start_date=document.getElementById("startDate").value
  97. var end_date=document.getElementById("endDate").value
  98. //alert(start_date+";"+end_date)
  99. kmedia.nonLiveStreaming({
  100. websocketUrl: 'wss://59.212.10.159',
  101. devId: '46902461001321000003',
  102. startTime: start_date,
  103. endTime: end_date
  104. })
  105. }
  106. </script>
  107. </html>