This commit is contained in:
@fawn-nine
2024-07-23 17:05:19 +08:00
parent dfaa65c7a2
commit 172e0fa2be
2 changed files with 7 additions and 190 deletions

View File

@@ -1,21 +1,5 @@
<template>
<view class="container" style="background-color: #000; position: relative">
<!-- <u-modal :show="show" :title="videoTitle" :content='content'></u-modal> -->
<!-- <u-icon
@click="goBack"
name="arrow-left"
color="#3ab3ae"
size="20"
:style="`display: inline-block; position: absolute; top: ${
statusBarHeight + 2
}px; left: ${10}px;z-index: 999;`"
></u-icon>-->
<!-- <zhimi_aliplayer_view
ref="playerView"
style="width: 100%; height: 300px"
></zhimi_aliplayer_view>
<button type="primary" @click="start()">开始</button>
<button type="primary" @click="pause()">暂停</button> -->
<view class="container" style="background-color: #000; position: relative">
<view style="width: 100%; height: 200px">
<view v-if="show" style="height: 100%;display: flex;align-items:center;justify-content:center;color: #fff;font-size: 38rpx;text-align: center;">
此设备暂不支持观看当前视频<br/>请移步到安卓手机进行学习
@@ -168,7 +152,7 @@
const ctx = this.$refs.myVideo;
ctx.exitFullScreen();
},
//
// 播放器初始化
async init(data, isChange) {
this.show = false;
this.platform = this.$platform;
@@ -182,62 +166,7 @@
this.videoId = this.options.video;
console.log("这是苹果视屏id", this.videoId);
await this.getLive(isChange);
},
async getVideo() {
var data = {};
var that = this;
$http
.request({
url: `sociology/course/ttt`,
method: "Post", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then(async (res) => {
console.log(" 视频播放11111111111:", res);
var credentials = res.result.credentials;
that.$refs.playerView.setVidSts({
vid: this.videoData.video,
accessKeyId: credentials.accessKeyId,
securityToken: credentials.securityToken,
accessKeySecret: credentials.accessKeySecret,
expireTime: credentials.expireTime,
Region: "cn-shanghai",
});
let isFullScreen = true;
// fixed fullscreen play on android
if (plus.os.name.toLowerCase() === "android") {
plus.key.addEventListener("backbutton", (e) => {
if (isFullScreen) {
that.$refs.playerView.changeScreenMode(0, false);
isFullScreen = false;
} else {
// 这里由于安卓无法监听返回按键这里只能通过plus监听然后自己模拟退回
uni.navigateBack();
}
});
}
that.$refs.playerView.setPlayerCallBack(({
type,
data
}) => {
switch (type) {
case "isFullScreen":
isFullScreen = Boolean(data);
break;
default:
console.log({
type,
data,
});
}
});
});
},
},
// 配置播放项
async getData(data, isChange) {
var that = this;
@@ -524,6 +453,7 @@
var that = this;
ownerInstance.callMethod('handleEnd', )
},
// renderjs阿里云播放器引入与配置
getLive() {
console.log('这是这只只是666666:', this.firstTime, this.videoData)
if (this.player) {
@@ -800,6 +730,7 @@
// //数据变化
console.log('currentVideoListcurrentVideoListcurrentVideoList', newValue)
},
// 监听视频参数变化,并赋值给常量
receiveMsg(newValue, oldValue, ownerVm, vm) {
//数据变化
videoData = newValue
@@ -819,7 +750,6 @@
this.checkValue();
}, 1000);
} else {
console.log('这是这只只是594:', this.firstTime, this.videoData)
this.getLive();
}