982 lines
26 KiB
Vue
982 lines
26 KiB
Vue
<template>
|
||
<view class="container" style="background-color: #000; position: relative">
|
||
<!-- <u-icon
|
||
@click="goBack"
|
||
name="arrow-left"
|
||
color="#258feb"
|
||
size="20"
|
||
:style="`display: inline-block; position: absolute; top: ${
|
||
statusBarHeight + 2
|
||
}px; left: ${10}px;z-index: 999;`"
|
||
></u-icon>-->
|
||
<view style="width: 100%; height: 200px" v-if="currentVideo.type == 1">
|
||
<div
|
||
class=""
|
||
style="background-color: #000"
|
||
ref="videoContent"
|
||
@tap="renderScript.handleClick"
|
||
id="url-player-test"
|
||
:videoData="videoData"
|
||
:winWidth="winWidth"
|
||
:winHeight="winHeight"
|
||
:currentVideoList="currentVideoList"
|
||
:firstTime="firstTime"
|
||
:change:videoData="renderScript.receiveMsg"
|
||
:change:winWidth="renderScript.receiveWinWidth"
|
||
:change:winHeight="renderScript.receiveWinHeight"
|
||
:change:firstTime="renderScript.receiveFirstTime"
|
||
:change:currentVideoList="renderScript.receiveVideoList"
|
||
></div>
|
||
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
|
||
直接调用renderjs中的emitData的方法,传递当前播放时长
|
||
</div>
|
||
<div @tap="renderScript.endEmitData" ref="videoContent2" v-show="false">
|
||
监听结束方法,记录播放时长
|
||
</div>
|
||
|
||
<div class="fullScreenButton-container">
|
||
<div
|
||
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
|
||
@tap="renderScript.changeVideoScreen"
|
||
></div>
|
||
<!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> -->
|
||
</div>
|
||
</view>
|
||
<view style="width: 100%; height: 200px; position: relative" v-else>
|
||
<video
|
||
@timeupdate="videoTimeUpdateEvent($event)"
|
||
ref="videos"
|
||
style="width: 100%; height: 100%"
|
||
autoplay
|
||
id="videoId"
|
||
object-fit="contain"
|
||
class="video-box"
|
||
:src="videoUrl"
|
||
:poster="`${videoUrl}?x-oss-process=video/snapshot,t_${1},f_jpg`"
|
||
@play="playVideo"
|
||
>
|
||
<cover-view style="position: absolute; top: 10px; z-index: 80">
|
||
<cover-view class="returnBack" @click="goBack">
|
||
<uni-icons type="back" size="26" color="#fff"></uni-icons>
|
||
<text class="txt">返回</text>
|
||
</cover-view>
|
||
</cover-view>
|
||
<!-- <cover-view v-if="isFullScreen && isControl">
|
||
<view class="right_title">
|
||
<view class="returnBack" @click="quitScreen">
|
||
<uni-icons type="back" size="26" color="#fff"></uni-icons>
|
||
<text class="txt">返回</text>
|
||
</view>
|
||
<view class="right_handle">
|
||
|
||
<uni-icons type="star" size="30" color="#fff"></uni-icons>
|
||
<uni-icons type="redo-filled" size="30" color="#fff"></uni-icons>
|
||
</view>
|
||
</view>
|
||
</cover-view> -->
|
||
</video>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
<script>
|
||
import $http from "@/config/requestConfig.js";
|
||
import { mapState, mapMutations } from "vuex";
|
||
|
||
// importScripts('@/static/aliplayer/aliplayer-min.js')
|
||
export default {
|
||
props: ["currentVideo", "currentVideoList"],
|
||
data() {
|
||
return {
|
||
//当前是否是全屏模式
|
||
isFullScreen: false,
|
||
isControl: true,
|
||
timer: null,
|
||
videoTitle: "",
|
||
videoList: [],
|
||
firstTime: 0,
|
||
options: {},
|
||
playAuth: "",
|
||
currentTime: "",
|
||
videoId: "",
|
||
videoData: {},
|
||
isSetFirstTime: false,
|
||
screenType: null,
|
||
videoUrl: null,
|
||
};
|
||
},
|
||
computed: {
|
||
...mapState(["videoOssList"]),
|
||
},
|
||
watch: {
|
||
currentVideo: {
|
||
immediate: true,
|
||
handler(newRoute) {},
|
||
},
|
||
},
|
||
// //页面显示
|
||
mounted() {},
|
||
async onUnload() {
|
||
uni.navigateTo({
|
||
url: "/pages/curriculum/order/curriculum/back",
|
||
});
|
||
// #ifdef APP-PLUS
|
||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||
|
||
// plus.screen.lockOrientation("portrait-primary");
|
||
// #endif
|
||
this.timer = null;
|
||
await this.setVideoTime();
|
||
this.player.dispose();
|
||
},
|
||
|
||
//第一次加载
|
||
onLoad(options) {
|
||
console.log(options, "这是传参");
|
||
// #ifdef APP-PLUS
|
||
|
||
setTimeout(() => {
|
||
plus.screen.unlockOrientation();
|
||
plus.screen.lockOrientation("landscape-primary");
|
||
}, 10);
|
||
// #endif
|
||
|
||
// #ifdef APP-PLUS
|
||
|
||
// plus.screen.lockOrientation("portrait-primary");
|
||
// #endif
|
||
if (uni.getStorageSync("videoOssList")) {
|
||
this.videoList = JSON.parse(uni.getStorageSync("videoOssList"));
|
||
}
|
||
|
||
console.log("this.videoList at line 53:", this.videoList);
|
||
|
||
this.options = JSON.parse(options.data);
|
||
|
||
this.videoId = this.options.video;
|
||
|
||
this.timer = setInterval(() => {
|
||
var that = this;
|
||
if (this.currentTime) {
|
||
that.setVideoTime();
|
||
}
|
||
}, 60000 * 10);
|
||
},
|
||
|
||
methods: {
|
||
screenChange(data) {
|
||
console.log(
|
||
"status at line 这是当前的状态158:",
|
||
data.status,
|
||
data.primary
|
||
);
|
||
this.isFullScreen = !data.status;
|
||
this.$emit("changeScreen", this.isFullScreen);
|
||
// let fullScreen = e.detail.fullScreen; // 值true为进入全屏,false为退出全屏
|
||
// if (!fullScreen) {
|
||
// //退出全屏
|
||
// this.isFullScreen = false;
|
||
// } else {
|
||
// this.isFullScreen = true;
|
||
// }
|
||
},
|
||
// 控制器的显示隐藏
|
||
controlChange(e) {
|
||
this.isControl = e.detail.show;
|
||
},
|
||
quitScreen() {
|
||
// 退出全屏
|
||
const ctx = this.$refs.myVideo;
|
||
ctx.exitFullScreen();
|
||
},
|
||
// 播放进度改变
|
||
videoTimeUpdateEvent(e) {
|
||
console.log("e at line 78:", e);
|
||
this.playTime = parseInt(e.detail.currentTime);
|
||
this.allTime = parseInt(e.detail.duration);
|
||
console.log("视频播放时长", this.playTime, "视频总时长", this.allTime);
|
||
|
||
this.recordTime({
|
||
time: this.playTime,
|
||
});
|
||
},
|
||
async init(data) {
|
||
// uni.getSystemInfo({
|
||
// success(res) {
|
||
// var winWidth = res.screenWidth;
|
||
// var winHeight = res.screenHeight;
|
||
// var statusBarHeight = res.statusBarHeight;
|
||
|
||
console.log("at line 59:", "是否先走这里");
|
||
if (uni.getStorageSync("videoOssList")) {
|
||
this.videoList = JSON.parse(uni.getStorageSync("videoOssList"));
|
||
}
|
||
this.options = data.currentVideo;
|
||
console.log("this.options at line 64:", this.options);
|
||
this.videoId = this.options.video;
|
||
this.timer = setInterval(async () => {
|
||
var that = this;
|
||
if (this.currentTime) {
|
||
await that.setVideoTime();
|
||
}
|
||
}, 60000 * 10);
|
||
await this.getLive();
|
||
},
|
||
getData(data) {
|
||
console.log(
|
||
"data at line 这是接口拿回来的时长11111111111111111111:",
|
||
this.videoData.userCourseVideoPositionEntity
|
||
);
|
||
if (!this.isSetFirstTime) {
|
||
var netWork = this.videoData.userCourseVideoPositionEntity
|
||
? this.videoData.userCourseVideoPositionEntity.position
|
||
: 0;
|
||
var list = JSON.parse(uni.getStorageSync("videoOssList"));
|
||
console.log("这是获取接口 设置的起始时长", netWork);
|
||
var index = list.findIndex((e) => e.id == this.videoData.id);
|
||
|
||
if (netWork) {
|
||
if (index >= 0) {
|
||
this.firstTime =
|
||
list[index].time > netWork ? list[index].time : netWork;
|
||
} else {
|
||
this.firstTime = netWork ? netWork : 0;
|
||
}
|
||
} else {
|
||
if (index >= 0) {
|
||
this.firstTime = list[index].time ? list[index].time : 0;
|
||
} else {
|
||
this.firstTime = 0;
|
||
}
|
||
}
|
||
|
||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||
console.log(
|
||
"list at line 这是设置完第一次初始值9777777777777777777770:",
|
||
list
|
||
);
|
||
if (this.currentVideo.type == 0 || this.currentVideo.type == 2) {
|
||
this.playVideo();
|
||
}
|
||
console.log(this.firstTime, "1111111111111111111111");
|
||
this.isSetFirstTime = true;
|
||
}
|
||
},
|
||
playVideo(e) {
|
||
this.videoContext = uni.createVideoContext("videoId", this);
|
||
|
||
this.videoContext.seek(this.firstTime);
|
||
// this.videoContext.requestFullScreen();
|
||
},
|
||
recordTime(data) {
|
||
this.currentTime = data.time;
|
||
console.log("data at line 54:", data);
|
||
var list = [];
|
||
if (uni.getStorageSync("videoOssList")) {
|
||
list = JSON.parse(uni.getStorageSync("videoOssList"));
|
||
}
|
||
|
||
console.log("list at line 56:", list);
|
||
console.log("点击后设置播放时长的方法list at line 65:", list);
|
||
var index = list.findIndex((e) => e.id == this.videoData.id);
|
||
if (list.length > 0 && index >= 0) {
|
||
list[index] = {
|
||
...this.videoData,
|
||
|
||
time: data.time,
|
||
};
|
||
} else {
|
||
list.push({
|
||
...this.videoData,
|
||
time: data.time,
|
||
});
|
||
}
|
||
|
||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||
|
||
console.log(list, "走接口的方法参数");
|
||
},
|
||
// 获取数据
|
||
getLive() {
|
||
var data = {
|
||
...this.options,
|
||
};
|
||
|
||
$http
|
||
.request({
|
||
url: `sociology/course/checkVideo`,
|
||
method: "Post", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||
data,
|
||
header: {
|
||
//默认 无 说明:请求头
|
||
"Content-Type": "application/json",
|
||
},
|
||
})
|
||
.then((res) => {
|
||
console.log("res at line 252111111111111111111111111111:", res);
|
||
if (this.currentVideo.type == 1) {
|
||
var playAuth = res.video.playAuth.replace(/=/g, "");
|
||
this.videoData = {
|
||
...res.video,
|
||
videoId: res.video.video,
|
||
playAuth: playAuth,
|
||
};
|
||
this.playAuth = playAuth;
|
||
} else {
|
||
this.videoData = res.video;
|
||
this.videoUrl =
|
||
// "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" +
|
||
res.video.videoUrl;
|
||
this.$nextTick(async () => {
|
||
await this.getData();
|
||
});
|
||
}
|
||
|
||
this.$forceUpdate();
|
||
});
|
||
},
|
||
async handleEnd() {
|
||
var list = JSON.parse(JSON.stringify(uni.getStorageSync("videoOssList")));
|
||
|
||
var data = list.find((e) => e.id == this.videoData.id);
|
||
|
||
this.currentTime = data.time;
|
||
|
||
await this.setVideoTime();
|
||
this.timer = null;
|
||
},
|
||
setVideoTime(time) {
|
||
var data = {
|
||
videoId: this.videoData.id,
|
||
position: this.currentTime, //秒数
|
||
};
|
||
console.log("data at line =存储视频时长接口:", data);
|
||
$http
|
||
.request({
|
||
// url: "book/buyOrder/buySave",
|
||
url: `sociology/course/saveCoursePosition`,
|
||
method: "Post", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||
data,
|
||
header: {
|
||
//默认 无 说明:请求头
|
||
"Content-Type": "application/json",
|
||
},
|
||
})
|
||
.then((res) => {
|
||
console.log("res at line 185:", res);
|
||
// console.log("data at line 5911111:", this.videoData);
|
||
this.$forceUpdate();
|
||
});
|
||
},
|
||
changePlayerTime(player) {
|
||
console.log("this.firstTime at line 106:", this.firstTime);
|
||
player.seek(this.firstTime);
|
||
},
|
||
goBack() {
|
||
uni.navigateBack({
|
||
delta: 1,
|
||
});
|
||
},
|
||
},
|
||
|
||
created() {},
|
||
};
|
||
</script>
|
||
|
||
<script module="renderScript" lang="renderjs">
|
||
|
||
import $ from 'jquery'
|
||
// import StaticADComponent from './staticadcomponent/index.js';
|
||
/**
|
||
* 静态广告组件
|
||
*/
|
||
|
||
|
||
export default {
|
||
/**
|
||
* 静态广告组件
|
||
*/
|
||
|
||
components: {
|
||
// MyComponent
|
||
},
|
||
mounted() {
|
||
// 在适合的生命周期,通过script和link标签引入播放器sdk、css
|
||
console.log(this.options, '这是monted')
|
||
this.loadWebPlayerSDK()
|
||
this.loadComponent()
|
||
},
|
||
data() {
|
||
return {
|
||
player: null,
|
||
curTime: null,
|
||
curStatus: null,
|
||
// currentTime:null,
|
||
}
|
||
},
|
||
|
||
|
||
watch: {
|
||
|
||
|
||
curTime(val) {
|
||
if (this.curTime !== null && this.curStatus !== null) {
|
||
this.$refs.videoContent1.click()
|
||
}
|
||
}
|
||
},
|
||
|
||
methods: {
|
||
|
||
handleClick(event, ownerInstance) {
|
||
console.log('event at line 165:', event)
|
||
// this.player.on('ready',function(){
|
||
// var status= this.player.fullscreenService.getIsFullScreen()
|
||
// console.log('status at line 403:', status)
|
||
// console.log('触发点击事件',status))
|
||
// })
|
||
|
||
ownerInstance.callMethod('getData')
|
||
|
||
},
|
||
emitData(event, ownerInstance) {
|
||
var that = this;
|
||
|
||
ownerInstance.callMethod('recordTime', {
|
||
time: that.curTime,
|
||
status: that.curStatus
|
||
})
|
||
|
||
},
|
||
changeVideoScreen(event, ownerInstance) {
|
||
var that = this;
|
||
// this.$emit('changeScreenLoading',true)
|
||
var status=this.player.fullscreenService.getIsFullScreen();
|
||
|
||
|
||
|
||
ownerInstance.callMethod('screenChange', {
|
||
status:status,
|
||
primary:status?'portrait':'landscape'
|
||
})
|
||
|
||
|
||
if(status){
|
||
|
||
|
||
|
||
setTimeout(() => {
|
||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||
this.player.fullscreenService.cancelFullScreen() ;
|
||
// this.$emit('changeScreenLoading',false);
|
||
|
||
|
||
}, 100);
|
||
|
||
|
||
// this.player.setPlayerSize('100%','200px');
|
||
|
||
|
||
|
||
|
||
}else{
|
||
|
||
// this.player.setPlayerSize({
|
||
// w:"400px",
|
||
// height:'60%'
|
||
// });
|
||
// plus.screen.unlockOrientation();
|
||
this.player.fullscreenService.requestFullScreen();
|
||
setTimeout(() => {
|
||
// this.$emit('changeScreenLoading',false);
|
||
plus.screen.lockOrientation("landscape-primary");
|
||
|
||
}, 100);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
},
|
||
endEmitData(event, ownerInstance) {
|
||
var that = this;
|
||
|
||
ownerInstance.callMethod('handleEnd', )
|
||
},
|
||
getLive() {
|
||
if(this.videoData.type==1){
|
||
var fullScreenButtonComponent = Aliplayer.Component({
|
||
/**
|
||
* 初始函数,在new对象时调用
|
||
*
|
||
* @param {string} adAddress - 广告视频地址
|
||
* @param {string} toAddress - 广告链接地址
|
||
*/
|
||
init: function (status, toAddress) {
|
||
|
||
this.fullScreenStatus=status
|
||
// this.adAddress = adAddress;
|
||
// this.toAddress = toAddress;
|
||
|
||
this.$html = $('.fullScreenButton-container');
|
||
// this.$html.hide();
|
||
},
|
||
|
||
/**
|
||
* 创建广告Dom元素
|
||
*/
|
||
createEl: function (el) {
|
||
|
||
|
||
this.$html.find('.ad').attr('src', this.adAddress);
|
||
var $adWrapper = this.$html.find('.ad-wrapper');
|
||
$adWrapper.attr('href', this.toAddress);
|
||
$adWrapper.click(function () {
|
||
// Aliplayer.util.stopPropagation();
|
||
});
|
||
// this.$html.find('.close').click(function () {
|
||
// this.$html.hide();
|
||
// });
|
||
// $(el).find('.prism-controlbar').append(this.$html);
|
||
$(el).find('.prism-time-display').after(this.$html);
|
||
},
|
||
ready: function (player, e) {
|
||
// this.$html.hide()
|
||
},
|
||
/**
|
||
* 隐藏广告
|
||
*/
|
||
play: function (player, e) {
|
||
// this.$html.show();
|
||
},
|
||
/**
|
||
* 显示广告
|
||
*/
|
||
pause: function (player, e) {
|
||
// this.$html.show();
|
||
},
|
||
/**
|
||
* 隐藏广告
|
||
*/
|
||
playing: function (player, e) {
|
||
this.$html.show();
|
||
// this.$html.hide();
|
||
},
|
||
waiting: function (player, e) {
|
||
// this.$html.hide()
|
||
},
|
||
timeupdate: function (player, e) {
|
||
},
|
||
error: function (player, e) {
|
||
},
|
||
/**
|
||
* 显示广告
|
||
*/
|
||
ended: function (player, e) {
|
||
// this.$html.show();
|
||
}
|
||
});
|
||
|
||
console.log('this.currentVideoList at line 456111111111111111111111:', this.videoList)
|
||
var player = new Aliplayer({
|
||
id: "url-player-test",
|
||
"vid": this.videoData
|
||
.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频)查询。示例:1e067a2831b641db90d570b6480f****。
|
||
"playauth": this.videoData.playAuth, // 必选参数,参数值可通过调用GetVideoPlayAuth接口获取。
|
||
"encryptType": 1, // 必选参数,当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
|
||
"playConfig": {
|
||
"EncryptType": 'AliyunVoDEncryption'
|
||
},
|
||
width: '100%', //容器的大小
|
||
// videoWidth: '100vw', //容器的大小
|
||
// videoHeight: '100vh', //容器的大小
|
||
height: '100%', //容器的大小
|
||
playsinline:true,
|
||
controlBarVisibility:"click",
|
||
cover:"",
|
||
components: [
|
||
// {
|
||
// name: 'BulletScreenComponent',
|
||
// type: AliPlayerComponent.BulletScreenComponent,
|
||
// /** Descriptions of the scrolling text component parameters: text, style, bulletPosition
|
||
// * text: The scrolling text
|
||
// * style: The style of the scrolling text
|
||
// * bulletPosition: The position of the scrolling text. Valid values: 'top', 'bottom', and 'random'. The default is 'random'.
|
||
// */
|
||
// args: ['本课程版权归天津众妙之门科技有限公司所有,翻版必究!', {fontSize: '16px', color: 'red',}, 'random']
|
||
// },
|
||
{name:'adComponent',type:fullScreenButtonComponent,args:['http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png']},
|
||
|
||
|
||
|
||
// {
|
||
// name: 'RotateMirrorComponent',
|
||
// type: AliPlayerComponent.RotateMirrorComponent
|
||
// },
|
||
|
||
|
||
],
|
||
|
||
skinLayout:[
|
||
{name: "bigPlayButton", align: "blabs", x: 30, y: 80},
|
||
{name: "H5Loading", align: "cc"},
|
||
{name: "errorDisplay", align: "tlabs", x: 0, y: 0},
|
||
{name: "infoDisplay"},
|
||
{name:"tooltip", align:"blabs",x: 0, y: 56},
|
||
{name: "thumbnail"},
|
||
{
|
||
name: "controlBar", align: "blabs", x: 0, y: 0,
|
||
children: [
|
||
{name: "progress", align: "blabs", x: 0, y: 44},
|
||
{name: "playButton", align: "tl", x: 15, y: 12},
|
||
{name: "timeDisplay", align: "tl", x: 10, y: 7},
|
||
// {name: "fullScreenButton", align: "tr", x: 10, y: 12},
|
||
// {name:"subtitle", align:"tr",x:15, y:12},
|
||
{name:"setting", align:"tr",x:15, y:12},
|
||
{name:"prism-speed-selector", align:"tr",x:15, y:12},
|
||
{name: "volume", align: "tr", x: 5, y: 10}
|
||
]
|
||
}
|
||
]
|
||
|
||
}, function(player) {
|
||
|
||
|
||
|
||
});
|
||
|
||
|
||
|
||
this.player = player;
|
||
this.$refs.videoContent.click()
|
||
|
||
var timer = setInterval(() => {
|
||
var that = this;
|
||
that.curTime = parseInt(this.player.getCurrentTime());
|
||
that.curStatus = this.player.getStatus()
|
||
|
||
}, 1000);
|
||
// player.on('ready',function(){
|
||
// player.fullscreenService.requestFullScreen()
|
||
|
||
// })
|
||
this.player.on('ended', function() {
|
||
console.log('that.curTime at line 242:', this.curTime)
|
||
console.log('that.curStatus at line 210:', this.curStatus)
|
||
this.$refs.videoContent2.click()
|
||
|
||
})
|
||
}
|
||
|
||
|
||
// player.setRotate(90)
|
||
|
||
//全屏播放
|
||
|
||
// player.one('canplay', function() {
|
||
// // console.log('canplay', this.player.tag);
|
||
// player.tag.play();
|
||
|
||
// });
|
||
|
||
|
||
|
||
},
|
||
receiveScreenType(newValue) {
|
||
console.log('newValue at line 427屏幕方向111111111111:', newValue)
|
||
|
||
},
|
||
receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
||
// //数据变化
|
||
|
||
console.log('newValue111', newValue)
|
||
|
||
console.log('vm4444', vm)
|
||
console.log('this.firstTime at line 215:', newValue)
|
||
if (this.player) {
|
||
this.player.seek(newValue);
|
||
}
|
||
|
||
|
||
},
|
||
receiveVideoList(newValue, oldValue, ownerVm, vm) {
|
||
// //数据变化
|
||
|
||
console.log('currentVideoListcurrentVideoListcurrentVideoList', newValue)
|
||
|
||
|
||
|
||
|
||
|
||
},
|
||
receiveMsg(newValue, oldValue, ownerVm, vm) {
|
||
//数据变化
|
||
// console.log('newValue', newValue)
|
||
// console.log('oldValue', oldValue)
|
||
// console.log('ownerVm', ownerVm)
|
||
// console.log('vm', vm)
|
||
},
|
||
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
|
||
//数据变化
|
||
console.log('newValue', newValue)
|
||
// console.log('oldValue', oldValue)
|
||
// console.log('ownerVm', ownerVm)
|
||
// console.log('vm', vm)
|
||
},
|
||
receiveWinHeight(newValue, oldValue, ownerVm, vm) {
|
||
//数据变化
|
||
console.log('newValue', newValue)
|
||
// console.log('oldValue', oldValue)
|
||
// console.log('ownerVm', ownerVm)
|
||
// console.log('vm', vm)
|
||
},
|
||
checkValue() {
|
||
console.log(this.videoId, this.authId, "1111888888")
|
||
if (!this.videoData.playAuth||!this.currentVideoList) {
|
||
setTimeout(() => {
|
||
this.checkValue();
|
||
}, 1000);
|
||
} else {
|
||
|
||
console.log('this.videoList at line 这是这只只是594:', this.currentVideoList)
|
||
this.getLive();
|
||
}
|
||
},
|
||
loadWebPlayerSDK() {
|
||
return new Promise((resolve, reject) => {
|
||
|
||
|
||
|
||
const s_tag = document.createElement('script'); // 引入播放器js
|
||
s_tag.type = 'text/javascript';
|
||
s_tag.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/aliplayer-min.js';
|
||
s_tag.charset = 'utf-8';
|
||
s_tag.onload = () => {
|
||
const s_tag1 = document.createElement('script'); // 引入播放器js
|
||
s_tag1.type = 'text/javascript';
|
||
s_tag1.src = 'https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js';
|
||
s_tag1.charset = 'utf-8';
|
||
s_tag1.onload = () => {
|
||
this.checkValue();
|
||
resolve();
|
||
|
||
}
|
||
document.body.appendChild(s_tag1);
|
||
|
||
}
|
||
document.body.appendChild(s_tag);
|
||
|
||
|
||
|
||
const l_tag = document.createElement('link'); // 引入播放器css
|
||
l_tag.rel = 'stylesheet';
|
||
l_tag.href =
|
||
'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
|
||
|
||
|
||
|
||
document.body.appendChild(l_tag);
|
||
});
|
||
},
|
||
loadComponent() {
|
||
// return new Promise((resolve, reject) => {
|
||
// const s_tag = document.createElement('script');
|
||
// s_tag.type = 'text/javascript';
|
||
// // 需要先下载组件 js 文件,放到项目 /static/ 目录下
|
||
// // 下载地址:https://github.com/aliyunvideo/AliyunPlayer_Web/blob/master/customComponents/dist/aliplayer-components/aliplayercomponents-1.0.9.min.js
|
||
// s_tag.src = '@/static/aliplayercomponents.js';
|
||
// s_tag.charset = 'utf-8';
|
||
// s_tag.onload = () => {
|
||
// resolve();
|
||
// }
|
||
// document.body.appendChild(s_tag);
|
||
// });
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style>
|
||
.container {
|
||
width: 100vw;
|
||
height: auto;
|
||
/deep/.pause {
|
||
width: 60rpx !important;
|
||
height: 60rpx !important;
|
||
}
|
||
}
|
||
|
||
.fds {
|
||
background-color: blue;
|
||
height: 600rpx;
|
||
position: fixed;
|
||
top: 60rpx;
|
||
}
|
||
|
||
.returnBack {
|
||
flex-direction: row;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
height: 88rpx;
|
||
padding-left: 20rpx;
|
||
}
|
||
|
||
.txt {
|
||
color: #fff;
|
||
}
|
||
|
||
.right_title {
|
||
background: #000;
|
||
height: 96rpx;
|
||
justify-content: space-between;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
margin-left: auto;
|
||
}
|
||
|
||
.return {
|
||
flex-direction: row;
|
||
align-items: center;
|
||
color: #fff;
|
||
}
|
||
|
||
.right_handle {
|
||
width: 200rpx;
|
||
flex-direction: row;
|
||
justify-content: flex-end;
|
||
padding-right: 20rpx;
|
||
}
|
||
|
||
cover-view {
|
||
display: block;
|
||
line-height: 1.2;
|
||
overflow: hidden;
|
||
white-space: nowrap;
|
||
pointer-events: auto;
|
||
}
|
||
cover-view {
|
||
visibility: visible !important;
|
||
}
|
||
|
||
cover-image {
|
||
visibility: visible !important;
|
||
}
|
||
|
||
.fullScreenButton-container {
|
||
color: #fff;
|
||
float: right;
|
||
height: 35px;
|
||
margin-top: 6px;
|
||
margin-right: 5px;
|
||
display: flex;
|
||
align-items: center;
|
||
position: relative;
|
||
i {
|
||
color: #fff;
|
||
display: inline-block;
|
||
font-size: 22px;
|
||
display: block;
|
||
margin-top: 7px;
|
||
cursor: pointer;
|
||
& + i {
|
||
margin-left: 3px;
|
||
}
|
||
@media (min-width: 768px) {
|
||
&:hover + .player-tooltip {
|
||
display: block;
|
||
}
|
||
}
|
||
}
|
||
.player-tooltip {
|
||
&.prev {
|
||
left: -10px;
|
||
}
|
||
&.list {
|
||
left: 5px;
|
||
}
|
||
&.next {
|
||
right: -12px;
|
||
}
|
||
}
|
||
}
|
||
.playlist-content {
|
||
position: absolute;
|
||
right: 0;
|
||
width: 0px;
|
||
padding-bottom: 48px;
|
||
box-sizing: border-box;
|
||
height: 100%;
|
||
transition: all 0.38s ease-in-out;
|
||
overflow: hidden;
|
||
.list {
|
||
background-color: #000;
|
||
background-color: rgba(0, 0, 0, 0.3);
|
||
height: 100%;
|
||
overflow: auto;
|
||
.video-item {
|
||
color: #fff;
|
||
padding: 0px 10px;
|
||
line-height: 35px;
|
||
font-size: 14px;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
cursor: pointer;
|
||
&.active {
|
||
background-color: #000;
|
||
color: #00ddff;
|
||
}
|
||
@media (min-width: 768px) {
|
||
&:hover {
|
||
background-color: #000;
|
||
color: #00ddff;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.player-tooltip {
|
||
position: absolute;
|
||
display: none;
|
||
font-size: 12px;
|
||
color: #fff;
|
||
line-height: 28px;
|
||
letter-spacing: 0;
|
||
text-align: center;
|
||
background: #3c3c3c;
|
||
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1);
|
||
height: 28px;
|
||
top: -48px;
|
||
padding: 0 5px;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.playlist-skip-tip {
|
||
padding: 5px 15px;
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
z-index: 30;
|
||
line-height: 30px;
|
||
font-size: 14px;
|
||
border-radius: 4px;
|
||
background: rgba(255, 255, 255, 0.8);
|
||
color: #000;
|
||
text-align: center;
|
||
transform: translate(-50%, -50%);
|
||
}
|
||
#rotating-div {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
background-color: #3498db;
|
||
transform: rotate(90deg); /* 旋转90度 */
|
||
transform-origin: center center; /* 设置旋转中心点在div中心 */
|
||
position: fixed; /* 固定定位,全屏显示 */
|
||
left: 0;
|
||
top: 0;
|
||
bottom: 0;
|
||
right: 0;
|
||
}
|
||
</style>
|