فهرست منبع

修改视频时长选定

huangjianlei 1 سال پیش
والد
کامیت
353cbeab4d
5فایلهای تغییر یافته به همراه54 افزوده شده و 37 حذف شده
  1. 38 26
      components/myPlayer2/tcPlayer.vue
  2. 4 1
      pages.json
  3. 3 3
      pages/learn/index.vue
  4. 7 5
      pages3/polyv/detail.vue
  5. 2 2
      pages5/webview/detaillink.vue

+ 38 - 26
components/myPlayer2/tcPlayer.vue

@@ -48,7 +48,6 @@
 			return {
 				vodPlayerJs: 'https://web.sdk.qcloud.com/player/tcplayer/release/v5.1.0/tcplayer.v5.1.0.min.js',
 				videoToastShow: false,
-				hasStart: false,
 				config: null,
 				Elevideo: false,
 				isInitSeek: false,
@@ -88,24 +87,24 @@
 					playbackRate = JSON.parse(JSON.stringify(this.playbackRate));
 				}
 				const TCPlayer = window.TCPlayer;
-				console.log("是否显示进度条", this.progressControl);
+				console.log("腾讯视频是否允许拖拽进度条", this.progressControl)
 				this.$api.tcVideoSign(this.fileId).then(async (res) => {
-					console.log('腾讯视频res', res)
+					console.log('请求腾讯视频参数', res)
 					let option = {
+						fakeFullscreen: true,
+						licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323759362_1/v_cube.license',
 						plugins: {
 							ContinuePlay: {
 								auto: true, // 是否禁用续播功能,取值:{true,false}。
 								SafeCheck: true // 安全检查
 							},
 						},
-						fakeFullscreen: true,
-						licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323759362_1/v_cube.license',
+						autoplay: this.autoplay, // 自动播放
+						playbackRates: playbackRate,
 						controlBar: {
 							progressControl: this.progressControl, // 是否禁止拖拽(隐藏)进度条
 							playbackRateMenuButton: playbackRateIndex // 是否显示倍速切换的按钮。
 						},
-						autoplay: this.autoplay, // 自动播放
-						playbackRates: playbackRate,
 						sources: [{
 							src: 'https://1500005692.vod2.myqcloud.com/43843706vodtranscq1500005692/62656d94387702300542496289/v.f100240.m3u8',
 						}],
@@ -121,11 +120,26 @@
 							appID: res.data.data.appID,
 							psign: res.data.data.psign
 						});
+						tcPlayerContext.currentTime(
+							this.currentTime || 0);
 					} else {
-						option = {
-							height: 218,
-							...option,
-						};
+						uni.getSystemInfo({
+							success: (res) => {
+								// // *****高度宽度的单位都是px 
+								// console.log(res.screenHeight); // 屏幕高度,包含导航栏
+								// console.log(res.windowHeight); // 能够使用的窗口高度,不包含导航栏
+								// console.log(res.screenWidth); // 屏幕宽度
+								// console.log(res.windowWidth); //  能够使用的窗口宽度
+								// // 能够使用的窗口高度,将px转换rpx
+								// this.windowHeight = (res.windowHeight * (750 / res.windowWidth))
+								// console.log(this.windowHeight)
+								option = {
+									width: res.windowWidth,
+									height: 218,
+									...option,
+								};
+							}
+						})
 						let player_tencent = document.createElement("video");
 						player_tencent.style.width = "100%";
 						player_tencent.id = "player-tencent";
@@ -146,7 +160,6 @@
 				console.log("腾讯视频恢复播放");
 				if (!this.PlayStart) {
 					this.onPlayStart();
-					return;
 				}
 				// 设置播放时间会重复触发
 				if (this.needSeek) {
@@ -174,12 +187,11 @@
 			// 		this.$emit('isSeeking', this.isSeeking);
 			// 	}
 			// },
-			onSeeked() {
-				console.log("触发拖拽结束");
-				this.isSeeking = false;
-				this.$emit('isSeeking', this.isSeeking);
-			},
-
+			// onSeeked() {
+			// 	console.log("触发拖拽结束");
+			// 	this.isSeeking = false;
+			// 	this.$emit('isSeeking', this.isSeeking);
+			// },
 			resumeVideo() {
 				tcPlayerContext.play();
 			},
@@ -192,14 +204,14 @@
 				if (!this.PlayStart) return
 				time = this.PlayStart == 1 ? (this.currentTime || 0) : this.playCurrentTime();
 
-				if (!this.isInitSeek) {
-					if (time >= this.ct) {
-						this.isInitSeek = true;
-					} else {
-						return;
-					}
-				}
-				this.onVideoSeek1(time);
+				// if (!this.isInitSeek) {
+				// 	if (time >= this.ct) {
+				// 		this.isInitSeek = true;
+				// 	} else {
+				// 		return;
+				// 	}
+				// }
+				// this.onVideoSeek1(time);
 
 				this.PlayStart++
 				this.$emit("timeupdate", time);

+ 4 - 1
pages.json

@@ -969,7 +969,10 @@
 						"app-plus": {
 							"titleNView": false, //禁用原生导航栏
 							"bounce": "none"
-						}
+						},
+						"mp-weixin": {
+							"pageOrientation": "auto"
+						} //横屏
 					}
 				},
 				{

+ 3 - 3
pages/learn/index.vue

@@ -914,7 +914,7 @@
 										isOther: 1,
 										skipPort: res.data.data.skipPort
 									}
-									let webViewUrl = encodeURIComponent('http://192.168.1.213:8081' +
+									let webViewUrl = encodeURIComponent('http://192.168.1.213:8080' +
 										'/pages3/polyv/detail?obj=' +
 										JSON.stringify(obj))
 									uni.navigateTo({
@@ -1078,7 +1078,7 @@
 												skipPort: res.data.data.skipPort
 											}
 											let webViewUrl = encodeURIComponent(
-												'http://192.168.1.213:8081' +
+												'http://192.168.1.213:8080' +
 												'/pages3/polyv/detail?obj=' +
 												JSON.stringify(obj))
 											uni.navigateTo({
@@ -1124,7 +1124,7 @@
 												skipPort: resForDetail.data.data.skipPort
 											}
 											let webViewUrl = encodeURIComponent(
-												'http://192.168.1.213:8081' +
+												'http://192.168.1.213:8080' +
 												'/pages3/polyv/detail?obj=' +
 												JSON.stringify(obj))
 											uni.navigateTo({

+ 7 - 5
pages3/polyv/detail.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="polyv_detail">
-		<uni-nav-bar :left-icon="isShowBack" :statusBar="true" fixed="true" :title="detail.courseName || '课程详情'"
-			@clickLeft="clickLeft"></uni-nav-bar>
+		<uni-nav-bar v-if="isShowBar" left-icon="back" :statusBar="true" fixed="true"
+			:title="detail.courseName || '课程详情'" @clickLeft="clickLeft"></uni-nav-bar>
 		<view id="top">
 			<view class="video_box" v-if="!playVid">
 				<image :src="$method.splitImgHost(goodsData.coverUrl)" mode="widthFix"
@@ -242,7 +242,7 @@
 				photoHistoryList: [], //已拍照历史的下标点
 				sectionItem: {},
 				// playSource: 2,
-				isShowBack: 'back',
+				isShowBar: true,
 				isRebuild: false, //视频是否从重修目录点击
 				livingItem: "",
 				option: null,
@@ -340,8 +340,9 @@
 			},
 		},
 		async onLoad(option) {
+			//腾讯播放器webview处理逻辑
 			if (option.obj) {
-				this.isShowBack = 'none';
+				this.isShowBar = false;
 				console.log("检测option.obj", option)
 				console.log("解析后的option.obj", JSON.parse(decodeURIComponent(option.obj)))
 				option = JSON.parse(decodeURIComponent(option.obj));
@@ -432,7 +433,8 @@
 				this.refPlv.playPause();
 			}
 		},
-		mounted() {},
+		mounted() {
+		},
 		methods: {
 			...mapMutations(["updateChapterOpen", "updateLiveLast"]),
 			async init() {

+ 2 - 2
pages5/webview/detaillink.vue

@@ -14,7 +14,7 @@
 				webviewStyles: {
 					progress: {
 						color: "#007AFF",
-					},
+					}
 				},
 				url: "",
 			};
@@ -24,7 +24,7 @@
 			// #ifdef H5
 			metaSetScalable();
 			// #endif
-		},
+		}
 	};
 </script>