Ver Fonte

直播回放

xuqiaoying há 3 anos atrás
pai
commit
57de8d626e
3 ficheiros alterados com 74 adições e 31 exclusões
  1. 2 2
      src/axios.js
  2. 25 4
      src/pages/live-detail/index.vue
  3. 47 25
      src/pages/living-room/index.vue

+ 2 - 2
src/axios.js

@@ -4,8 +4,8 @@ import { Message } from 'element-ui'
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-export const BASE_URL = 'http://192.168.1.7:5055'    //dev
-// export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
+// export const BASE_URL = 'http://192.168.1.7:5055'    //dev
+export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'http://192.168.1.222:5055'    //测试
 export const tenantId = '867735392558919680'

+ 25 - 4
src/pages/live-detail/index.vue

@@ -4525,6 +4525,7 @@ export default {
       });
     },
     polyvLiveHistoryChatMsgList() {
+      // /polyv/live/historyChatMsgList-查询保利威节聊天历史
       this.$request
         .polyvLiveHistoryChatMsgList({
           sectionId: this.playSectionId,
@@ -4762,6 +4763,7 @@ export default {
      * 点击节
      */
     async getResource(section) {
+      console.log('回放回放', section)
       //逻辑
 
       if (section.type == 2) {
@@ -5056,6 +5058,7 @@ export default {
       }
     },
     async initVideo(option) {
+      console.log('initVideo', option)
       if (option.sectionType == 1 || option.sectionType == 3) {
         //录播
 
@@ -5190,10 +5193,27 @@ export default {
     },
 
     async playVideo(option) {
-      console.log(option, "option");
+      console.log(option, "<-----option");
       if (option.sectionType == 1 || option.sectionType == 3) {
-        //录播
-
+        //录播和回放
+        if (option.sectionType == 3) {
+          this.$router.push({
+            path: "/living-room/" + option.liveUrl,
+            query: {
+              goodsId: this.goodsId,
+              courseId: this.courseId,
+              gradeId: this.gradeId,
+              orderGoodsId: this.orderGoodsId,
+              sectionId: option.sectionId || option.menuId,
+              chapterId: option.chapterId || 0,
+              moduleId: option.moduleId || 0,
+              sectionType: 3,
+              goodsName: option.name,
+              vid: option.recordingUrl, // 回放vid
+            }          
+          })
+          return
+        }
         //设置播放的节ID
 
         //提交保存观看历史
@@ -5276,7 +5296,8 @@ export default {
             chapterId: option.chapterId || 0,
             moduleId: option.moduleId || 0,
             sectionType: 2,
-          },
+            goodsName: option.name,
+          },          
         });
         // this.loadPlayerScriptzb(this.loadPlayerzb);
         // setTimeout(() => {

+ 47 - 25
src/pages/living-room/index.vue

@@ -229,7 +229,8 @@ export default {
       goodsStatus: 0, // 0未上架,1上架
       showAuth: false, 
       shareShow: false,
-      sectionType: '',
+      sectionType: 2, //sectionType: 2, // 节类型 1录播 2直播 3回放	
+      vid: '', // 回放的id
       formShare: {
         links: '',
         ercode: '',
@@ -269,21 +270,26 @@ export default {
       return
     }
     // 下面不是复制链接进来的
-    this.sectionId = this.$route.query.sectionId;
-    this.goodsId = this.$route.query.goodsId;
-    this.courseId = this.$route.query.courseId;
-    this.orderGoodsId = this.$route.query.orderGoodsId;
-    this.gradeId = +this.$route.query.gradeId;
-    this.chapterId = this.$route.query.chapterId;
-    this.moduleId = this.$route.query.moduleId;
-    this.channelId = this.$route.params.channelId;
-    this.goodsName = this.$route.query.goodsName
-    this.sectionType = this.$route.query.sectionType
+    const {sectionId, goodsId, courseId, orderGoodsId, gradeId, chapterId, moduleId, goodsName, sectionType, vid} = this.$route.query
+    this.sectionId = sectionId
+    this.goodsId = goodsId
+    this.courseId = courseId
+    this.orderGoodsId = orderGoodsId
+    this.gradeId = +gradeId
+    this.chapterId = chapterId
+    this.moduleId = moduleId
+    // this.channelId = this.$route.params.channelId;
+    this.goodsName = goodsName
+    this.sectionType = sectionType
+    this.vid = vid
     this.identification = new Date().valueOf() + ""
     this.buyCourse = 0
     // this.getParam()
     this.playVideo();
-    this.studyRecordGetLastLive();
+    if (this.sectionType !=3 ) {
+      this.studyRecordGetLastLive();
+    }
+    
   },
   beforeDestroy() {
     if (!this.$tools.isLogin()) return
@@ -419,6 +425,8 @@ export default {
           channelId: this.channelId,
         })
         .then((res) => {
+          console.log('------------res', res.code)
+          if (res.code == 200) {
           this.sign = res.data.sign;
           this.token = res.data.token;
           this.mediaChannelKey = res.data.mediaChannelKey;
@@ -428,6 +436,9 @@ export default {
           this.loadPlayerzb();
           // 新增用户视频学习日志
           this.studyLog()
+          } else {
+            this.$message.warning(res.msg)
+          }
         });
     },
 
@@ -544,22 +555,33 @@ export default {
       ); // 监听流状态变化
 
       // 第四步:监听频道信息读取完成事件,初始化播放器
+      let options = {
+        el: els.playerEl,
+        pptEl: els.pptEl,
+        pptPlaceholder: true,
+        switchPlayer: true,
+        controllerPosition: "ppt",
+        fixedController: true,
+        controllerEl: els.controllerEl,
+        pptNavBottom: "80px",
+        barrage: true, // 是否开启弹幕
+        defaultBarrageStatus: true,
+        autoplay: true,
+      }
+      if (this.sectionType == 3) {
+        // 回放模式需要fileId、url、sessionId
+        // fileId: undefined, //ppt数据id,回放模式必填
+        // url: undefined,  // 回放视频链接,回放模式必填
+        // sessionId: undefined, // 回放场次id,回放模式必填
+        // vid: undefined,  // 回放id,回放模式下传入该参数,可不传fileId、url、sessionId
+        options.type = 'vod',
+        options.vid = this.vid
+      }
+      console.log('options', options)
       this.plv.liveSdk.on(
         PolyvLiveSdk.EVENTS.CHANNEL_DATA_INIT,
         (event, data) => {
-          this.plv.liveSdk.setupPlayer({
-            el: els.playerEl,
-            pptEl: els.pptEl,
-            pptPlaceholder: true,
-            switchPlayer: true,
-            controllerPosition: "ppt",
-            fixedController: true,
-            controllerEl: els.controllerEl,
-            pptNavBottom: "80px",
-            barrage: true, // 是否开启弹幕
-            defaultBarrageStatus: true,
-            autoplay: true,
-          });
+          this.plv.liveSdk.setupPlayer(options);
 
           this.plv.liveSdk.player.on(
             "fullscreenChange",