Browse Source

更改播放器

Limengbo 5 years ago
parent
commit
4fa3a9dba1
5 changed files with 119 additions and 40 deletions
  1. 18 4
      src/index.html
  2. 72 26
      src/js/main.js
  3. 0 1
      src/js/request.js
  4. 0 0
      src/js/utils.js
  5. 29 9
      src/style/index.less

+ 18 - 4
src/index.html

@@ -5,15 +5,29 @@
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>首页</title>
-  <script src="https://lib.baomitu.com/chimee-player/1.1.9/chimee-player.browser.js"></script>
+  <!-- <script src="https://lib.baomitu.com/chimee-player/1.1.9/chimee-player.browser.js"></script> -->
+  <script src="//cdn.jsdelivr.net/npm/xgplayer@1.1.4/browser/index.js" charset="utf-8"></script>
+  <script src="//cdn.jsdelivr.net/npm/xgplayer-flv.js/browser/index.js" charset="utf-8"></script>
 </head>
 <body>
   <div class="container">
     <div class="header">智能共享白板</div>
     <div class="video">
-      <p class="title">
-        字节跳动-抖音-二季度KPI考核会议
-      </p>
+      <div class="title">
+        <p></p>
+        <div id="btn">
+            <label>
+                <input type="radio" name="type" id="adviceRadio2" value="desktopUrl" checked hidden/>
+                <label for="adviceRadio2" class="advice"></label>
+                <span class="radio-name">会议视频</span>
+            </label>
+            <label>
+                <input type="radio" name="type" id="adviceRadio1" value="boardUrl" hidden/>
+                <label for="adviceRadio1" class="advice"></label>
+                <span class="radio-name">白板视频</span>
+            </label>
+        </div>
+      </div>
       <div class="big-video" id="bigVideo">
       </div>
       <div class="small-video" id="smallVideo">

+ 72 - 26
src/js/main.js

@@ -12,34 +12,80 @@ $(document).ready(function() {
   const desktopUrl = JSON.parse(dataList).shareTask.desktopUrl;
   const title = JSON.parse(dataList).shareTask.title;
   const shareJoinUserId =  JSON.parse(dataList).shareJoinUser.id;
-  $('.title').html(title)
-  let bigVideo = new ChimeePlayer({
-    wrapper: '#bigVideo',  // video dom容器
-    src: boardUrl,
-    box: 'hls',
-    isLive: true,
-    autoplay: true,
-    muted: false
+  $('.title p').html(title)
+  /**
+   * chimeeplayer播放器
+   */
+  // let bigVideo = new ChimeePlayer({
+  //   wrapper: '#bigVideo',  // video dom容器
+  //   src: 'http://live.ai160.com/SCREEN/SCREEN1559033120490640.flv',
+  //   box: 'flv',
+  //   isLive: true,
+  //   autoplay: true,
+  //   muted: false
+  // });
+  // let smallVideo = new ChimeePlayer({
+  //   wrapper: '#smallVideo',  // video dom容器
+  //   src: 'http://live.ai160.com/SCREEN/SCREEN1559033120490640.flv',
+  //   box: 'flv',
+  //   isLive: true,
+  //   autoplay: true,
+  //   muted: true
+  // });
+  let bigVideo = new FlvJsPlayer({
+		"id": "bigVideo",
+		"url": desktopUrl,
+		"playsinline": false,
+		"volume": 1,
+    "autoplay": true,
+    "width": "100%",
+    "height": "714",
+    "ignores": ['definition', 'i18n', 'play', 'replay', 'progress', 'start', 'volume'],
+    "closeVideoClick": true,
+    "closeVideoTouch": true,
+    "keyShortcut": "off",
+    "cssFullscreen": true
   });
-  let smallVideo = new ChimeePlayer({
-    wrapper: '#smallVideo',  // video dom容器
-    src: desktopUrl,
-    box: 'hls',
-    isLive: true,
-    autoplay: true,
-    muted: true
+  let smallVideo = new FlvJsPlayer({
+		"id": "smallVideo",
+		"url": boardUrl,
+		"playsinline": false,
+		"volume": 1,
+    "autoplay": true,
+    "width": "100%",
+    "height": "714",
+    "ignores": ['definition', 'i18n', 'play', 'replay', 'progress', 'start', 'volume'],
+    "closeVideoClick": true,
+    "closeVideoTouch": true,
+    "keyShortcut": "off",
+    "cssFullscreen": true
   });
-  $('#smallVideo').click(function () {
-    $('#bigVideo').removeClass('big-video').addClass('small-video');
-    $('#smallVideo').removeClass('small-video').addClass('big-video');
-    smallVideo.muted = false;
-    bigVideo.muted = true;
-  })
-  $('#bigVideo').click(function () {
-    $('#bigVideo').removeClass('small-video').addClass('big-video');
-    $('#smallVideo').removeClass('big-video').addClass('small-video');
-    smallVideo.muted = true;
-    bigVideo.muted = false;
+  $('#smallVideo').hide();
+  // $('#smallVideo').click(function () {
+  //   $('#bigVideo').removeClass('big-video').addClass('small-video');
+  //   $('#smallVideo').removeClass('small-video').addClass('big-video');
+  //   smallVideo.muted = false;
+  //   bigVideo.muted = true;
+  // })
+  // $('#bigVideo').click(function () {
+  //   $('#bigVideo').removeClass('small-video').addClass('big-video');
+  //   $('#smallVideo').removeClass('big-video').addClass('small-video');
+  //   smallVideo.muted = true;
+  //   bigVideo.muted = false;
+  // })
+  console.log(smallVideo)
+  $('input:radio').click(function () {
+    // console.log($(this).val())
+    const type = $(this).val();
+    if (type == 'desktopUrl') {
+      $('#bigVideo').show();
+      $('#smallVideo').hide();
+    } else {
+      $('#bigVideo').hide();
+      $('#smallVideo').show();
+    }
+    // player.flvOpts.url = 'http://aldirect.flv.huya.com/huyalive/94525224-2460686034-10568566041753944064-2789274542-10057-A-0-1.flv?wsSecret=a90ccc2ccf9420344d388def9c190893&wsTime=5ced08e1&ratio=500'
+    // console.log(player.config.url)
   })
   // 判断用户是否存在回调
   function shareJoin () {

+ 0 - 1
src/js/request.js

@@ -1 +0,0 @@
-import $ from 'jquery';

+ 0 - 0
src/js/utils.js


+ 29 - 9
src/style/index.less

@@ -18,23 +18,43 @@
     background: #000;
     padding: 10px 325px;
     .title {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
       width: 100%;
       font-size: 24px;
       color: #fff;
       margin-left: 50px;
+      #btn {
+        font-size: 18px; 
+        .advice{
+          height: 12px;
+          width: 12px;
+          display: inline-block;
+          background-image: url('https://caiyunupload.b0.upaiyun.com/newweb/imgs/icon-unchecked.png');
+          background-repeat: no-repeat;
+          background-position: center;
+          vertical-align: middle;
+          margin-top: -4px;
+        }
+        input[type="radio"]:checked + .advice{
+          background-image: url('https://caiyunupload.b0.upaiyun.com/newweb/imgs/icon-checked.png');
+        }
+      }
     }
-    .big-video {
+    .big-video,
+    .small-video {
       width: 100%;
       height: 714px;
     }
-    .small-video {
-      position: fixed;
-      top: 170px;
-      right: 341px;
-      width: 218px;
-      height: 122px;
-      z-index: 2;
-    }
+    // .small-video {
+    //   position: fixed;
+    //   top: 170px;
+    //   right: 341px;
+    //   width: 218px;
+    //   height: 122px;
+    //   z-index: 2;
+    // }
   }
   .footer {
     width: 100%;