소스 검색

修改拖拉进度条属性

huangjianlei 1 년 전
부모
커밋
f6869bf142
3개의 변경된 파일37개의 추가작업 그리고 25개의 파일을 삭제
  1. 25 13
      components/myPlayer2/tcPlayer.vue
  2. 3 3
      pages/learn/index.vue
  3. 9 9
      pages3/polyv/detail.vue

+ 25 - 13
components/myPlayer2/tcPlayer.vue

@@ -27,10 +27,10 @@
 				type: Boolean,
 				default: false,
 			},
-			controlBar: {
+			progressControl: {
 				type: Boolean,
 				default: () => {
-					return true //是否禁止拖拽进度条,取值:{true,false}。
+					return false //是否禁止拖拽进度条,取值:{true,false}。
 				}
 			},
 			currentTime: {
@@ -79,14 +79,18 @@
 			},
 			// 播放视频
 			loadPlayer() {
+				let playbackRateIndex = true;
+				let playbackRate = [1];
 				if (this.playbackRate.length <= 1) {
-					var playbackRate = [1];
+					playbackRateIndex = false;
 				} else {
-					var playbackRate = JSON.parse(JSON.stringify(this.playbackRate));
+					playbackRateIndex = true;
+					playbackRate = JSON.parse(JSON.stringify(this.playbackRate));
 				}
 				const TCPlayer = window.TCPlayer;
-				console.log("是否显示进度条", this.controlBar);
+				console.log("是否显示进度条", this.progressControl);
 				this.$api.tcVideoSign(this.fileId).then(async (res) => {
+					console.log('腾讯视频res', res)
 					let option = {
 						plugins: {
 							ContinuePlay: {
@@ -94,15 +98,23 @@
 								SafeCheck: true // 安全检查
 							},
 						},
+						controlBar: {
+							progressControl: this.progressControl, // 是否禁止拖拽(隐藏)进度条
+							playbackRateMenuButton: playbackRateIndex // 是否显示倍速切换的按钮。
+						},
+						playbackRates: playbackRate,
+						autoplay: this.autoplay, // 自动播放
+						fakeFullscreen: true,
+
 						sources: [{
 							src: 'https://1500005692.vod2.myqcloud.com/43843706vodtranscq1500005692/62656d94387702300542496289/v.f100240.m3u8',
 						}],
 						licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323759362_1/v_cube.license',
-						playbackRates: playbackRate,
-						autoplay: this.autoplay, // 自动播放
-						controlBar: {
-							progressControl: this.controlBar
-						} // 是否禁止拖拽(隐藏)进度条
+
+						// fileID: res.data.data.fileID,
+						// appID: res.data.data.appID,
+						// psign: res.data.data.psign,
+						// licenseUrl: res.data.data.licenseUrl,
 					};
 					if (tcPlayerContext) {
 						tcPlayerContext.currentTime(
@@ -129,7 +141,7 @@
 				});
 			},
 			playing() {
-				if(this.isSeeking) return;
+				// if (this.isSeeking) return;
 				console.log("腾讯视频恢复播放");
 				if (!this.PlayStart) {
 					this.onPlayStart();
@@ -176,7 +188,7 @@
 				console.log("腾讯视频播放err", err);
 			},
 			timeupdate(e) {
-				if(this.isSeeking) return;
+				// if (this.isSeeking) return;
 				let time = 0;
 				if (!this.PlayStart) return
 				time = this.PlayStart == 1 ? (this.currentTime || 0) : this.playCurrentTime();
@@ -237,7 +249,7 @@
 				// }).then((res) => {});
 			},
 			onVideoSeek1(time) {
-				if (!this.controlBar) {
+				if (!this.progressControl) {
 					if (Math.abs(time - this.playTime) > 5) {
 						console.log("进度条回拉", this.playTime, this.ct);
 						this.seekVideo(this.playTime);

+ 3 - 3
pages/learn/index.vue

@@ -914,7 +914,7 @@
 								})
 								// #endif
 								// #ifdef MP-WEIXIN
-								webViewUrl = encodeURIComponent(res.data.data.domain +
+								webViewUrl = encodeURIComponent('http://192.168.1.213:8080' +
 									'/pages3/polyv/detail?obj=' +
 									JSON.stringify(obj))
 								uni.navigateTo({
@@ -1074,7 +1074,7 @@
 										// #endif
 										// #ifdef MP-WEIXIN
 										webViewUrl = encodeURIComponent(
-											res.data.data.domain +
+											'http://192.168.1.213:8080' +
 											'/pages3/polyv/detail?obj=' +
 											JSON.stringify(obj))
 										uni.navigateTo({
@@ -1115,7 +1115,7 @@
 										// #endif
 										// #ifdef MP-WEIXIN
 										webViewUrl = encodeURIComponent(
-											res.data.data.domain +
+											'http://192.168.1.213:8080' +
 											'/pages3/polyv/detail?obj=' +
 											JSON.stringify(obj))
 										uni.navigateTo({

+ 9 - 9
pages3/polyv/detail.vue

@@ -15,10 +15,10 @@
 					@playerError="playerError" @studyLog="studyLog"></my-player>
 			</view>
 			<view v-else>
-				<!-- <my-player2 src="/pages3/tencent/detail?vid=xxx" vid="xxx"></my-player2> -->
-				<my-player2 ref="player2" :playFileId="playVid" :autoplay="autoplay" :controlBar=true
-					:playbackRate="playbackRate" :currentTime="videoCurrentTime || 0" @playing="playing" @isSeeking="isSeeking" @seeked="seeked" @pause="pause"
-					@ended="ended" @loadedmetadata="loadedmetadata" @timeupdate="timeupdate" @playerError="playerError"
+				<my-player2 ref="player2" :playFileId="playVid" :autoplay="autoplay" :progressControl=isAllowSeek
+					:playbackRate="playbackRate" :currentTime="videoCurrentTime || 0" @playing="playing"
+					@isSeeking="isSeeking" @seeked="seeked" @pause="pause" @ended="ended"
+					@loadedmetadata="loadedmetadata" @timeupdate="timeupdate" @playerError="playerError"
 					@studyLog="studyLog"></my-player2>
 			</view>
 			<view class="course_name">
@@ -436,7 +436,7 @@
 			...mapMutations(["updateChapterOpen", "updateLiveLast"]),
 			async init() {
 				if (this.playSource == 2) {
-					this.isAllowSeek = true;
+					this.isAllowSeek = false;
 				} else {
 					// #ifdef MP-WEIXIN
 					this.isAllowSeek = "no";
@@ -1485,7 +1485,7 @@
 				this.timeEvent(time);
 			},
 			playing() {
-				if(this.isSeekingIndex) return;
+				// if (this.isSeekingIndex) return;
 				//特殊设备跳过拍照停止学习
 				if (this.showCamera) {
 					this.refPlv.playPause();
@@ -1510,13 +1510,13 @@
 				this.showCamera = false;
 			},
 			pause() {
-				if(this.isSeekingIndex) return;
+				// if (this.isSeekingIndex) return;
 				console.log("视频暂停");
 				this.isPlaying = false;
 				this.erJianErZaoPauseTip();
 			},
 			async ended() {
-				if(this.isSeekingIndex) return;
+				// if (this.isSeekingIndex) return;
 				console.log("视频播放完毕");
 				this.isPlaying = false;
 				uni.showToast({
@@ -1676,7 +1676,7 @@
 					}
 					if (this.goodsPlayConfig.drag > 0 && !this.erJianErZao) {
 						if (this.playSource == 2) {
-							this.isAllowSeek = false;
+							this.isAllowSeek = true;
 						} else {
 							// #ifdef MP-WEIXIN
 							this.isAllowSeek = "yes";