videoDetail.jsp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/webpage/include/taglibf.jsp"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta charset="utf-8">
  7. <title>${fns:getConfig("productName")}</title>
  8. <link rel="stylesheet" href="${ctxStaticWeb}/css/base.css" />
  9. <link rel="stylesheet" href="${ctxStaticWeb}/css/second.css" />
  10. <script src="${ctxStaticWeb}/js/jquery-1.8.3.min.js" type="text/javascript"></script>
  11. <script>
  12. $(document).ready(function() {
  13. $('.videoWrapper').bind('contextmenu',function() { return false; });
  14. $('#myvideo').bind('contextmenu',function() { return false; });
  15. var init_num=0;
  16. var myvideo= $("#myvideo")[0];//document.getElementById('myvideo');
  17. if(myvideo==null){
  18. //myvideo = document.getElementsByClassName("note-video-clip");
  19. }
  20. //console.log(myvideo);
  21. var totalTimes = 0 ;
  22. var videoScoreType = '${news.scoreType}';
  23. if(myvideo!=null){
  24. /*myvideo.addEventListener('play',function(){
  25. if(init_num==0){
  26. init_num++;
  27. }
  28. });*/
  29. //视频可以播放触发事件
  30. myvideo.addEventListener("canplay",function(){
  31. totalTimes = Math.ceil(this.duration); //视频总时长
  32. console.log("total:"+totalTimes);
  33. alert(videoScoreType);
  34. if(videoScoreType=='1'){//1-进入观看得分
  35. $.ajax({
  36. url:"${ctxF}/videonews/setVideoInfo",
  37. type:"POST",
  38. cache: false,
  39. dataType:"json",
  40. data: {id: '${news.id}',totalRecord:totalTimes,typeId:'${news.typeId}'},
  41. success: function(data){
  42. console.log("canplay:"+data.success);
  43. },
  44. complete: function(XMLHttpRequest, textStatus){
  45. }
  46. });
  47. }
  48. })
  49. //播放过程中
  50. myvideo.addEventListener("timeupdate",function(){
  51. //用秒数来显示当前播放进度
  52. var timeDisplay = Math.floor(myvideo.currentTime);
  53. //当视频播放时间大于1分钟
  54. if(timeDisplay>=60 && timeDisplay %60==0){//60秒一更新
  55. if(videoScoreType=='2'){//2-观看一定时长得分
  56. console.log("timeupdate:"+timeDisplay);
  57. $.ajax({
  58. url:"${ctxF}/videonews/updateVideoTime",
  59. type:"POST",
  60. cache: false,
  61. dataType:"json",
  62. data: {id: '${news.id}',totalRecord:totalTimes,typeId:'${news.typeId}',record:timeDisplay},
  63. success: function(data){
  64. console.log("timeupdate result:"+data.success);
  65. },
  66. complete: function(XMLHttpRequest, textStatus){
  67. //do something in the end...
  68. }
  69. });
  70. }
  71. }
  72. },false);
  73. //视频播放完成
  74. myvideo.addEventListener("ended",function(){
  75. if(videoScoreType=='2'){//2-观看一定时长得分
  76. $.ajax({
  77. url:"${ctxF}/videonews/updateVideoTime",
  78. type:"POST",
  79. cache: false,
  80. dataType:"json",
  81. data: {id: '${news.id}',totalRecord:totalTimes,typeId:'${news.typeId}',record:totalTimes},
  82. success: function(data){
  83. console.log("ended:"+data.success);
  84. },
  85. complete: function(XMLHttpRequest, textStatus){
  86. //do something in the end...
  87. }
  88. });
  89. }
  90. })
  91. }
  92. })
  93. </script>
  94. <style type="text/css">
  95. video::-internal-media-controls-download-button {
  96. display:none;
  97. }
  98. video::-webkit-media-controls-enclosure {
  99. overflow:hidden;
  100. }
  101. video::-webkit-media-controls-panel {
  102. width: calc(100% + 30px);
  103. }
  104. </style>
  105. </head>
  106. <body>
  107. <%@ include file="/webpage/modules/web/top.jsp"%>
  108. <div class="new w">
  109. <div class="position">当前位置:<a href="${ctx}/">网站首页</a>&nbsp;&#62;&nbsp;<a href="${ctxF}/videonews?typeId=${news.typeId}">${news.typeName}</a>&nbsp;&#62;&nbsp;详细内容</div>
  110. </div>
  111. <div class="new w" style="border:1px solid #ccc">
  112. <div class="text_top">
  113. <h1>${news.title}</h1>
  114. <hr>
  115. <h2>发布日期:<span><fmt:formatDate value="${news.createDate}" pattern="yyyy-MM-dd"/></span>&nbsp;&nbsp;文章来源:<span>${news.source==''?'--':news.source}</span> </h2>
  116. </div>
  117. <div class="text">
  118. <c:if test="${news.url1 != null && news.url1 !=''}">
  119. <c:if test="${news.typeId != '2'}">
  120. <div class="img">
  121. <video scrolling="no" height="100%" controlsList="nodownload" autoplay style="scrolling:no;background-color: black;" width="100%" src='${news.url1}' controls="controls" id="myvideo">
  122. 您的浏览器不支持视频标签.
  123. </video>
  124. </div>
  125. </c:if>
  126. <c:if test="${news.typeId == '2'}">
  127. <div class="img">
  128. <%--<iframe src="http://dygbjy.12371.cn/zbpd/" width="100%" height="1000" ></iframe>--%>
  129. <iframe src="${news.url1}" width="100%" height="550" ></iframe>
  130. </div>
  131. </c:if>
  132. </c:if>
  133. <p>${fns:unescapeHtml(news.contents)}</p>
  134. </div>
  135. </div>
  136. <%@ include file="/webpage/modules/web/footer.jsp"%>
  137. </body>
  138. </html>