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" : "图片路径" "src" : "图片路径"
} }
], ],
"versionName" : "1.0.09", "versionName" : "1.0.11",
"versionCode" : 1009, "versionCode" : 1011,
"app-plus" : { "app-plus" : {
"nvueCompiler" : "weex", "nvueCompiler" : "weex",
"compatible" : { "compatible" : {

View File

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

View File

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