wangguoyu 7 meses atrás
pai
commit
5b9cb0641c
2 arquivos alterados com 24 adições e 34 exclusões
  1. 15 32
      components/questionJiexi/questionJiexi.vue
  2. 9 2
      pages/study/lookShipin.vue

+ 15 - 32
components/questionJiexi/questionJiexi.vue

@@ -18,8 +18,11 @@
 						<view class="spjj-title"></view>
 						<view class="spjj-video-box">
 							<!-- 这里放视频 ↓ -->
-							<view class="spjj-video" ref="videoContent" id="wgy-player-test" :playAuth="playAuth"
+							<view class="spjj-video" ref="videoContent" id="wgy-player-test" 
+							:playAuth="playAuth"
 								:change:playAuth="renderScript.receiveMsg" 
+								:videoId="videoId"
+									:change:videoId="renderScript.videoId" 
 								 :seekTime="seekTime"
 								:change:seekTime="renderScript.seekTimeFun">
 							</view>
@@ -55,8 +58,8 @@
 		methods: {
 			showPopup(item){
 				this.data = item;
-				//this.videoId = item.jiangjie
-				this.videoId = 'b997f16cb9cb474cb93526cff77d8801'
+				this.videoId = item.jiangjie
+				//this.videoId = 'b997f16cb9cb474cb93526cff77d8801'
 			//	this.progressMarkers = item.progressMarkers
 				this.getLive(); //获取播放凭证
 				this.$refs.popupRef.open()
@@ -101,6 +104,7 @@
 			return {
 				player: null,
 				playAuth: '',
+				videoId: '',
 				progressMarkers: [],
 				seekTime: ''
 
@@ -113,6 +117,11 @@
 					this.playAli()
 				}
 			},
+			videoId(newValue, oldValue, ownerInstance, instance) {
+				if (newValue) {
+					this.videoId = newValue
+				}
+			},
 			progressMarkersMsg(newValue, oldValue, ownerInstance, instance) {
 				if (newValue) {
 					this.progressMarkers = newValue
@@ -122,34 +131,8 @@
 				if (newValue) {
 					console.log(newValue, 'newValuenewValuenewValuenewValuenewValue')
 					console.log(this.player.getStatus(), 'newValuenewValuenewValuenewValuenewValue')
-					switch (this.player.getStatus()) {
-						case 'init':
-							break;
-						case 'ready':
-							break;
-						case 'loading':
-						 this.player.play()
-						this.player.seek(newValue)
-							break;
-						case 'play':
-							this.player.seek(newValue)
-							break;
-						case 'pause':
-						this.player.play()
-						this.player.seek(newValue)
-							break;
-						case 'playing':
-						this.player.seek(newValue)
-							break;
-						case 'waiting':
-							break;
-						case 'error':
-							break;
-						case 'ended':
-							break;
-						default:
-							break;
-					}
+					this.player.play()
+					this.player.seek(newValue)
 					//	this.player.seek(newValue)
 				}
 			},
@@ -157,7 +140,7 @@
 				//配置播放器
 				var player = new Aliplayer({
 					id: "wgy-player-test",
-					"vid": 'b997f16cb9cb474cb93526cff77d8801',
+					"vid": this.videoId,
 					"playauth": this.playAuth,
 					// "playConfig": {
 					// 	"EncryptType": 'AliyunVoDEncryption'

+ 9 - 2
pages/study/lookShipin.vue

@@ -5,6 +5,7 @@
 			<text class="nav-bar-title">视频播放</text>
 		</view>
 		<view ref="videoContent" id="wgy-player-test" :playAuth="playAuth" :change:playAuth="renderScript.receiveMsg"
+			:videoId="videoId" :change:videoId="renderScript.videoId"
 			:progressMarkers="progressMarkers" :change:progressMarkers="renderScript.progressMarkersMsg"
 			:seekTime="seekTime" :change:seekTime="renderScript.seekTimeFun" class="course-video-box">
 		</view>
@@ -133,6 +134,7 @@
 			return {
 				player: null,
 				playAuth: '',
+				videoId: '',
 				progressMarkers: [],
 				seekTime: ''
 
@@ -153,6 +155,11 @@
 					this.playAli()
 				}
 			},
+				videoId(newValue, oldValue, ownerInstance, instance) {
+				if (newValue) {
+					this.videoId = newValue
+				}
+			},
 			progressMarkersMsg(newValue, oldValue, ownerInstance, instance) {
 
 				if (newValue) {
@@ -202,13 +209,13 @@
 				//配置播放器
 				var player = new Aliplayer({
 					id: "wgy-player-test",
-					"vid": 'b997f16cb9cb474cb93526cff77d8801',
+					"vid": this.videoId,
 					"playauth": this.playAuth,
 					// "playConfig": {
 					// 	"EncryptType": 'AliyunVoDEncryption'
 					// },
 					"qualitySort": "asc",
-					"format": "m3u8",
+					"format": "mp4",
 					"mediaType": "video",
 					"encryptType": 1,
 					"progressMarkers": this.progressMarkers,