This commit is contained in:
@fawn-nine
2024-07-23 14:05:53 +08:00
parent 87d32db367
commit 8004ee57c1
3 changed files with 56 additions and 58 deletions

View File

@@ -12,8 +12,8 @@
"src" : "图片路径"
}
],
"versionName" : "1.0.09",
"versionCode" : 1009,
"versionName" : "1.0.11",
"versionCode" : 1011,
"app-plus" : {
"nvueCompiler" : "weex",
"compatible" : {

View File

@@ -1,6 +1,6 @@
<template>
<view class="container" style="background-color: #000; position: relative">
<u-modal :show="show" :title="title" :content='content'></u-modal>
<!-- <u-modal :show="show" :title="videoTitle" :content='content'></u-modal> -->
<!-- <u-icon
@click="goBack"
name="arrow-left"
@@ -17,7 +17,10 @@
<button type="primary" @click="start()">开始</button>
<button type="primary" @click="pause()">暂停</button> -->
<view style="width: 100%; height: 200px">
<div class="" style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick"
<view v-if="show" style="height: 100%;display: flex;align-items:center;justify-content:center;color: #fff;font-size: 38rpx;text-align: center;">
此设备暂不支持观看当前视频<br/>请移步到安卓手机进行学习
</view>
<div class="" v-else style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick"
id="url-player-test" :videoData="videoData" :winWidth="winWidth" :winHeight="winHeight"
:currentVideoList="currentVideoList" :firstTime="firstTime" :isfresh="isfresh" :platform="platform"
:isSetFirstTime="isSetFirstTime" :isChange="isChange" :change:videoData="renderScript.receiveMsg"
@@ -76,7 +79,7 @@
// importScripts('@/static/aliplayer/aliplayer-min.js')
export default {
props: ["currentVideo", "currentVideoList"],
props: ["currentVideo", "currentVideoList","videoTitle"],
data() {
return {
show: false,
@@ -88,7 +91,7 @@
isChange: false,
isControl: true,
timer: null,
videoTitle: "",
// videoTitle: "",
videoList: [],
firstTime: 0,
options: {},
@@ -436,17 +439,23 @@
});
},
async handleEnd() {
console.log('进来了吗handleEnd')
console.log("找到了吗????",this.videoData.id);
// console.log('uni.getStorageSync("videoOssList")',uni.getStorageSync("videoOssList"));
var list = JSON.parse(JSON.stringify(uni.getStorageSync("videoOssList")));
var data = list.find((e) => e.id == this.videoData.id);
console.log("找到了吗????");
this.currentTime = data.time;
console.log(
"this.currentTime at line 这是结束的时候掉的存储视频:",
this.currentTime
);
await this.setVideoTime();
clearInterval(this.$store.state.videoTimer);
this.timer = null;
await this.setVideoTime();
},
setVideoTime(time) {
var data = {};
@@ -767,17 +776,19 @@
var playerOptions = {
id: "url-player-test",
// preload: false,
// "vid": this.videoData
// .videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
width: '100%', //容器的大小
// videoWidth: '100vw', //容器的大小
// videoHeight: '100vh', //容器的大小
height: '100%', //容器的大小
// playsinline: true,
// controlBarVisibility: "click",
cover: "",
                width: '100%', //容器的大小
                height: '100%', //容器的大小
                "qualitySort": "asc",
//             "format": "m3u8",
//             "mediaType": "video",
                "cover": "",
                "autoplay": true,
            "isLive": false,
            "rePlay": false,
            "playsinline": true,
            "controlBarVisibility": "hover",
            "useH5Prism": true,
// cover: "",
components: [
// {
// name: 'BulletScreenComponent',
@@ -888,14 +899,16 @@
}
if (this.videoData.type == 1) {
if (this.videoData.m3u8Url == null || this
.videoData.m3u8Url == '') {
//console.log('这是私有加密的视频');
if (this.videoData.m3u8Url == null || this.videoData.m3u8Url == '') {
console.log('这是私有加密的视频');
if (this.$platform == 'ios') {
this.$refs.videoContent5.click()
} else {
playerOptions = {
...playerOptions,
"vid": this.videoData
.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
"playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
"encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
"playConfig": {
@@ -903,14 +916,12 @@
}
}
console.log('这是私有加密的视频');
}
}
} else if (this.videoData.m3u8Url != null || this.videoData.m3u8Url != '') {
playerOptions = {
...playerOptions,
source: this.videoData.m3u8Url,
playConfig: {
"EncryptType": 'HLSEncryption'
}
// "playConfig": {"EncryptType": "HLSEncryption"}
}
console.log('这是标准加密的视频');
}
@@ -922,30 +933,7 @@
}
console.log('这是没有加密的视频');
}
console.log('playerOptions',playerOptions);
// if (this.videoData.type == 1 && this.videoData.m3u8Url == null || this.videoData.type == 1 && this
// .videoData.m3u8Url == '') {
// playerOptions = {
// ...playerOptions,
// "playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
// "encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
// "playConfig": {
// "EncryptType": 'AliyunVoDEncryption'
// }
// }
// console.log('这是私有加密的视频');
// } else if (this.videoData.type == 1 && this.videoData.m3u8Url != null && this.videoData.type == 1 && this
// .videoData.m3u8Url != '') {
// playerOptions = {
// ...playerOptions,
// source: this.videoData.m3u8Url,
// playConfig: {
// "EncryptType": 'HLSEncryption'
// }
// }
// console.log('这是标准加密的视频');
// }
var player = new Aliplayer(playerOptions, function(player) {});
this.player = player;
console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
@@ -975,7 +963,10 @@
// })
} else {
this.player.seek(this.firstTime)
// if(player){
this.player.seek(this.firstTime)
// }
}

View File

@@ -358,14 +358,21 @@ export default {
// this.getUserInfo()
// this.getCateList()
},
onUnload(){
beforeDestroy(){
console.log('页面卸载')
// this.$nextTick(()=>{
this.$refs.commonVideo.handleEnd();
// this.$refs.commonVideo.handleEnd();
// })
},
onUnload(){
// console.log('页面卸载')
// // this.$nextTick(()=>{
// this.$refs.commonVideo.handleEnd();
// // })
},
onHide() {