未修复
This commit is contained in:
@@ -4,31 +4,27 @@
|
|||||||
"version" : "0.0",
|
"version" : "0.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"app-plus" :
|
"app-plus" : {
|
||||||
{
|
"launchtype" : "remote"
|
||||||
"launchtype" : "remote"
|
},
|
||||||
},
|
"default" : {
|
||||||
"default" :
|
"launchtype" : "local"
|
||||||
{
|
},
|
||||||
"launchtype" : "local"
|
"h5" : {
|
||||||
},
|
"launchtype" : "local"
|
||||||
"h5" :
|
},
|
||||||
{
|
"mp-weixin" : {
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
"mp-weixin" :
|
"provider" : "aliyun",
|
||||||
{
|
"type" : "uniCloud"
|
||||||
"launchtype" : "local"
|
|
||||||
},
|
|
||||||
"provider" : "aliyun",
|
|
||||||
"type" : "uniCloud"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"playground" : "custom",
|
"playground" : "custom",
|
||||||
"type" : "uni-app:app-ios"
|
"type" : "uni-app:app-ios"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"playground" : "custom",
|
"playground" : "standard",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container" style="background-color: #000; position: relative">
|
<view class="container" style="background-color: #000; position: relative">
|
||||||
<view style="width: 100%; height: 200px">
|
<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;">{{errorTxt}}</view>
|
<view v-if="showCountDown" class="showCountDownd" style="">
|
||||||
|
<view class="">
|
||||||
|
<text class="nextText">{{secondCountDown}} 秒后播放下一个视频</text><br/>
|
||||||
|
<view >
|
||||||
|
<text class="cancelNext" @click="hideNextVideo">取消下一个</text>
|
||||||
|
<!-- <text class="cancelNext" @click="replayVideo">重新播放</text> -->
|
||||||
|
</view>
|
||||||
|
<!-- <view class="cancelNext" @click="hideNextVideo">重新播放</view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="show"
|
||||||
|
style="height: 100%;display: flex;align-items:center;justify-content:center;color: #fff;font-size: 38rpx;text-align: center;">
|
||||||
|
{{errorTxt}}</view>
|
||||||
<div class="" v-else style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick"
|
<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"
|
||||||
|
:replayVideoFlag="replayVideoFlag"
|
||||||
:change:winWidth="renderScript.receiveWinWidth" :change:winHeight="renderScript.receiveWinHeight"
|
:change:winWidth="renderScript.receiveWinWidth" :change:winHeight="renderScript.receiveWinHeight"
|
||||||
:change:firstTime="renderScript.receiveFirstTime"
|
:change:firstTime="renderScript.receiveFirstTime"
|
||||||
|
:change:replayVideoFlag="renderScript.receiveReplayVideoFlag"
|
||||||
:change:isSetFirstTime="renderScript.receiveisSetFirstTime"
|
:change:isSetFirstTime="renderScript.receiveisSetFirstTime"
|
||||||
:change:isfresh="renderScript.receiveIsfresh" :change:platform="renderScript.receiveplatform"
|
:change:isfresh="renderScript.receiveIsfresh" :change:platform="renderScript.receiveplatform"
|
||||||
:change:isChange="renderScript.receiveIsChange"
|
:change:isChange="renderScript.receiveIsChange"
|
||||||
@@ -29,6 +43,15 @@
|
|||||||
<div @tap="renderScript.emitopenShow" ref="videoContent5" v-show="false" class="videoContent5">
|
<div @tap="renderScript.emitopenShow" ref="videoContent5" v-show="false" class="videoContent5">
|
||||||
打开视频提示
|
打开视频提示
|
||||||
</div>
|
</div>
|
||||||
|
<div @tap="renderScript.emitLoadNextVideo" ref="videoContent6" v-show="false" class="videoContent6">
|
||||||
|
播放下一条
|
||||||
|
</div>
|
||||||
|
<div @tap="renderScript.emitHideNextVideo" ref="videoContent7" v-show="false" class="videoContent7">
|
||||||
|
隐藏播放下一条界面
|
||||||
|
</div>
|
||||||
|
<div @tap="renderScript.emitReplayVideoFlagFalse" ref="videoContent8" v-show="false" class="videoContent8">
|
||||||
|
隐藏播放下一条界面
|
||||||
|
</div>
|
||||||
<div class="fullScreenButton-container">
|
<div class="fullScreenButton-container">
|
||||||
<div :class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
|
<div :class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
|
||||||
@tap="renderScript.changeVideoScreen"></div>
|
@tap="renderScript.changeVideoScreen"></div>
|
||||||
@@ -45,10 +68,10 @@
|
|||||||
} from "vuex";
|
} from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ["currentVideo", "currentVideoList","videoTitle"],
|
props: ["currentVideo", "currentVideoList", "videoTitle",'secondCountDown'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
reaquestFlag:false,
|
reaquestFlag: false,
|
||||||
show: false,
|
show: false,
|
||||||
platform: null,
|
platform: null,
|
||||||
//当前是否是全屏模式
|
//当前是否是全屏模式
|
||||||
@@ -57,8 +80,13 @@
|
|||||||
isChange: false,
|
isChange: false,
|
||||||
isControl: true,
|
isControl: true,
|
||||||
timer: null,
|
timer: null,
|
||||||
|
replayVideoFlag:false,
|
||||||
|
// secondCountDown: 5,
|
||||||
|
showCountDown: false,
|
||||||
|
playEndBlank:false,
|
||||||
// videoTitle: "",
|
// videoTitle: "",
|
||||||
videoList: [],
|
videoList: [],
|
||||||
|
replayVideoLock:false,// 重播操作锁
|
||||||
firstTime: 0,
|
firstTime: 0,
|
||||||
options: {},
|
options: {},
|
||||||
playAuth: "",
|
playAuth: "",
|
||||||
@@ -68,7 +96,7 @@
|
|||||||
isSetFirstTime: false,
|
isSetFirstTime: false,
|
||||||
screenType: null,
|
screenType: null,
|
||||||
videoUrl: null,
|
videoUrl: null,
|
||||||
errorTxt:'此设备暂不支持观看当前视频请移步到安卓手机进行学习!'
|
errorTxt: '此设备暂不支持观看当前视频请移步到安卓手机进行学习!'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -111,6 +139,39 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
replayVideo(){
|
||||||
|
if(!this.replayVideoFlag){
|
||||||
|
this.getLive(true, this.currentVideo)
|
||||||
|
console.log('this.currentVideo',this.currentVideo.id);
|
||||||
|
this.hideNextVideo()
|
||||||
|
this.replayVideoFlag = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
replayVideoFlagFalse(){
|
||||||
|
console.log('复原replayVideoFlag',this.replayVideoFlag);
|
||||||
|
this.replayVideoFlag = false
|
||||||
|
},
|
||||||
|
hideNextVideo(){
|
||||||
|
this.showCountDown = false
|
||||||
|
this.playEndBlank = false
|
||||||
|
this.$emit('hideNextVideo')
|
||||||
|
},
|
||||||
|
loadNextVideo() {
|
||||||
|
this.playEndBlank = true
|
||||||
|
var _list = [...this.currentVideoList]
|
||||||
|
_list = _list.map(item => { return item.id})
|
||||||
|
|
||||||
|
var thisIndex = _list.findIndex(item=>{
|
||||||
|
return item == this.currentVideo.id
|
||||||
|
})
|
||||||
|
console.log('播放列表',_list,this.currentVideo.id, thisIndex);
|
||||||
|
if(thisIndex < this.currentVideoList.length-1){
|
||||||
|
this.showCountDown = true
|
||||||
|
this.$emit('startNextVideoCountDown')
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
openShow(data) {
|
openShow(data) {
|
||||||
data.msg ? this.errorTxt = data.msg : '此设备暂不支持观看当前视频请移步到安卓手机进行学习'
|
data.msg ? this.errorTxt = data.msg : '此设备暂不支持观看当前视频请移步到安卓手机进行学习'
|
||||||
this.show = true;
|
this.show = true;
|
||||||
@@ -127,7 +188,7 @@
|
|||||||
this.isChange = false;
|
this.isChange = false;
|
||||||
},
|
},
|
||||||
async changeVideo(data) {
|
async changeVideo(data) {
|
||||||
console.log('changeVideo+++++++++',data);
|
console.log('changeVideo+++++++++', data);
|
||||||
this.currentTime = "";
|
this.currentTime = "";
|
||||||
this.firstTime = 0;
|
this.firstTime = 0;
|
||||||
this.isSetFirstTime = false;
|
this.isSetFirstTime = false;
|
||||||
@@ -166,7 +227,7 @@
|
|||||||
|
|
||||||
this.videoId = this.options.video;
|
this.videoId = this.options.video;
|
||||||
console.log("这是苹果视屏id", this.videoId);
|
console.log("这是苹果视屏id", this.videoId);
|
||||||
await this.getLive(isChange);
|
await this.getLive(isChange,this.options);
|
||||||
},
|
},
|
||||||
// 配置播放项
|
// 配置播放项
|
||||||
async getData(data, isChange) {
|
async getData(data, isChange) {
|
||||||
@@ -180,7 +241,7 @@
|
|||||||
list = JSON.parse(uni.getStorageSync("videoOssList"));
|
list = JSON.parse(uni.getStorageSync("videoOssList"));
|
||||||
|
|
||||||
var index = list.findIndex((e) => e.id == data.id);
|
var index = list.findIndex((e) => e.id == data.id);
|
||||||
console.log('data.id',data.id);
|
console.log('data.id', data.id);
|
||||||
if (netWork) {
|
if (netWork) {
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.firstTime =
|
this.firstTime =
|
||||||
@@ -201,7 +262,7 @@
|
|||||||
|
|
||||||
this.videoData = {
|
this.videoData = {
|
||||||
...data,
|
...data,
|
||||||
firstTime : this.firstTime
|
firstTime: this.firstTime
|
||||||
};
|
};
|
||||||
this.isChange = isChange ? isChange : false;
|
this.isChange = isChange ? isChange : false;
|
||||||
console.log(this.firstTime, "这是第一次播放时长222");
|
console.log(this.firstTime, "这是第一次播放时长222");
|
||||||
@@ -212,7 +273,7 @@
|
|||||||
},
|
},
|
||||||
// 存储本地播放时间
|
// 存储本地播放时间
|
||||||
recordTime(data) {
|
recordTime(data) {
|
||||||
console.log('recordTime',data.time);
|
console.log('recordTime', data.time);
|
||||||
this.currentTime = data.time;
|
this.currentTime = data.time;
|
||||||
|
|
||||||
var list = [];
|
var list = [];
|
||||||
@@ -235,11 +296,12 @@
|
|||||||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||||||
},
|
},
|
||||||
// 获取播放凭证
|
// 获取播放凭证
|
||||||
async getLive(isChange,newVideoData) {
|
async getLive(isChange, newVideoData) {
|
||||||
if(this.reaquestFlag){
|
console.log('获取播放凭证',newVideoData.id);
|
||||||
|
if (this.reaquestFlag) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'操作太快了,歇一下吧',
|
title: '操作太快了,歇一下吧',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.reaquestFlag = true
|
this.reaquestFlag = true
|
||||||
@@ -248,7 +310,7 @@
|
|||||||
var data = {
|
var data = {
|
||||||
...this.options,
|
...this.options,
|
||||||
};
|
};
|
||||||
if(isChange && newVideoData){
|
if (isChange && newVideoData) {
|
||||||
data = {
|
data = {
|
||||||
...newVideoData,
|
...newVideoData,
|
||||||
};
|
};
|
||||||
@@ -264,20 +326,22 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
|
||||||
this.reaquestFlag = false
|
this.reaquestFlag = false
|
||||||
if (this.$platform == 'ios') {
|
if (this.$platform == 'ios') {
|
||||||
if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo.type == 1 && res.video.m3u8Url == '') {
|
if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo
|
||||||
|
.type == 1 && res.video.m3u8Url == '') {
|
||||||
// 只存在私有加密
|
// 只存在私有加密
|
||||||
this.show = true
|
this.show = true
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
content: '抱歉,苹果手机不支持此加密视频格式,您可以在安卓端观看本视频',
|
content: '抱歉,苹果手机不支持此加密视频格式,您可以在安卓端观看本视频',
|
||||||
confirmText: '知道了',
|
confirmText: '知道了',
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// uni.navigateBack({delta: 2})
|
// uni.navigateBack({delta: 2})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -311,7 +375,7 @@
|
|||||||
this.reaquestFlag = false
|
this.reaquestFlag = false
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
'title': '获取播放地址失败',
|
'title': '获取播放地址失败',
|
||||||
icon:'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -319,7 +383,7 @@
|
|||||||
async handleEnd() {
|
async handleEnd() {
|
||||||
var list = JSON.parse(uni.getStorageSync("videoOssList"));
|
var list = JSON.parse(uni.getStorageSync("videoOssList"));
|
||||||
var data = list.find((e) => e.id == this.videoData.id);
|
var data = list.find((e) => e.id == this.videoData.id);
|
||||||
this.currentTime = data.time;
|
this.currentTime = data.time;
|
||||||
console.log(
|
console.log(
|
||||||
"this.currentTime at line 这是结束的时候掉的存储视频:",
|
"this.currentTime at line 这是结束的时候掉的存储视频:",
|
||||||
this.currentTime
|
this.currentTime
|
||||||
@@ -331,9 +395,9 @@
|
|||||||
// 存储时长到线上
|
// 存储时长到线上
|
||||||
setVideoTime(time) {
|
setVideoTime(time) {
|
||||||
var data = {};
|
var data = {};
|
||||||
console.log("是否走了存储视屏," + this.videoData.id, time,this.currentTime);
|
console.log("是否走了存储视屏," + this.videoData.id, time, this.currentTime);
|
||||||
let _time = null
|
let _time = null
|
||||||
time ? _time = time : _time = this.currentTime
|
time ? _time = time : _time = this.currentTime
|
||||||
var data = {
|
var data = {
|
||||||
videoId: this.videoData.id,
|
videoId: this.videoData.id,
|
||||||
position: _time, //秒数
|
position: _time, //秒数
|
||||||
@@ -375,8 +439,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script module="renderScript" lang="renderjs">
|
<script module="renderScript" lang="renderjs">
|
||||||
|
var GolbalPlayerOptions = {}
|
||||||
var videoData = null
|
var videoData = null
|
||||||
var _seconds = 0
|
var _seconds = 0
|
||||||
|
var ReplayVideoFlag = false
|
||||||
var curStatus = null
|
var curStatus = null
|
||||||
var diff = 0
|
var diff = 0
|
||||||
var myplayer = undefined
|
var myplayer = undefined
|
||||||
@@ -389,6 +455,7 @@
|
|||||||
// 在适合的生命周期,通过script和link标签引入播放器sdk、css
|
// 在适合的生命周期,通过script和link标签引入播放器sdk、css
|
||||||
console.log(this.options, '这是monted')
|
console.log(this.options, '这是monted')
|
||||||
this.loadWebPlayerSDK()
|
this.loadWebPlayerSDK()
|
||||||
|
this.loadComponent()
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -419,6 +486,23 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
receiveReplayVideoFlag(newValue, oldValue, ownerVm, vm) {
|
||||||
|
console.log('newValue重新播放',newValue,myplayer);
|
||||||
|
ReplayVideoFlag = newValue
|
||||||
|
if(newValue){
|
||||||
|
$('.videoContent8').click()
|
||||||
|
// ReplayVideoFlag = newValue
|
||||||
|
// // myplayer.replay()
|
||||||
|
// $('.videoContent7').click()
|
||||||
|
// myplayer.seek(0)
|
||||||
|
// myplayer.play()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
emitReplayVideoFlagFalse(event, ownerInstance) {
|
||||||
|
ownerInstance.callMethod('replayVideoFlagFalse')
|
||||||
|
},
|
||||||
async receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
async receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -427,20 +511,28 @@
|
|||||||
},
|
},
|
||||||
emitSetData(event, ownerInstance) {
|
emitSetData(event, ownerInstance) {
|
||||||
// var that = this;
|
// var that = this;
|
||||||
ownerInstance.callMethod('setVideoFirtsetTime',{
|
ownerInstance.callMethod('setVideoFirtsetTime', {
|
||||||
time: _seconds,
|
time: _seconds,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
emitHideNextVideo(event, ownerInstance) {
|
||||||
|
ownerInstance.callMethod('hideNextVideo')
|
||||||
|
},
|
||||||
|
emitLoadNextVideo(event, ownerInstance) {
|
||||||
|
ownerInstance.callMethod('loadNextVideo')
|
||||||
|
},
|
||||||
emitopenShow(event, ownerInstance) {
|
emitopenShow(event, ownerInstance) {
|
||||||
ownerInstance.callMethod('openShow',{msg:'播放出错啦!'})
|
ownerInstance.callMethod('openShow', {
|
||||||
|
msg: '播放出错啦!'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 全屏切换事件
|
// 全屏切换事件
|
||||||
changeVideoScreen(event, ownerInstance) {
|
changeVideoScreen(event, ownerInstance) {
|
||||||
var that = this;
|
var that = this;
|
||||||
// this.$emit('changeScreenLoading',true)
|
// this.$emit('changeScreenLoading',true)
|
||||||
var status = this.player.fullscreenService.getIsFullScreen();
|
var status = this.player.fullscreenService.getIsFullScreen();
|
||||||
console.log('this.$platform--------',this.platform);
|
console.log('this.$platform--------', this.platform);
|
||||||
if (this.platform != 'ios') { // 改变按钮形态
|
if (this.platform != 'ios') { // 改变按钮形态
|
||||||
ownerInstance.callMethod('screenChange', {
|
ownerInstance.callMethod('screenChange', {
|
||||||
status: status,
|
status: status,
|
||||||
primary: status ? 'portrait' : 'landscape'
|
primary: status ? 'portrait' : 'landscape'
|
||||||
@@ -449,10 +541,10 @@
|
|||||||
if (status) {
|
if (status) {
|
||||||
if (this.platform != 'ios') {
|
if (this.platform != 'ios') {
|
||||||
console.log('恢复竖版');
|
console.log('恢复竖版');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||||||
this.player.fullscreenService.cancelFullScreen();
|
this.player.fullscreenService.cancelFullScreen();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.player.fullscreenService.requestFullScreen();
|
this.player.fullscreenService.requestFullScreen();
|
||||||
@@ -460,7 +552,7 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
plus.screen.lockOrientation("landscape-primary");
|
plus.screen.lockOrientation("landscape-primary");
|
||||||
}, 100);
|
}, 100);
|
||||||
}else{
|
} else {
|
||||||
console.log('不要旋转, 使用原生全屏');
|
console.log('不要旋转, 使用原生全屏');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,8 +568,8 @@
|
|||||||
},
|
},
|
||||||
// renderjs阿里云播放器引入与配置
|
// renderjs阿里云播放器引入与配置
|
||||||
getLive() {
|
getLive() {
|
||||||
console.log('这是这只只是666666:', this.firstTime, this.videoData)
|
// console.log('这是这只只是666666:', this.firstTime, this.videoData)
|
||||||
if (this.player) {
|
if (myplayer) {
|
||||||
this.player.dispose();
|
this.player.dispose();
|
||||||
$('#url-player-test').empty();
|
$('#url-player-test').empty();
|
||||||
this.player = null;
|
this.player = null;
|
||||||
@@ -538,24 +630,22 @@
|
|||||||
/**
|
/**
|
||||||
* 显示广告
|
* 显示广告
|
||||||
*/
|
*/
|
||||||
ended: function(player, e) {
|
ended: function(player, e) {}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
console.log('这是查看是否获取到hlstoken', this.videoData)
|
// console.log('这是查看是否获取到hlstoken', this.videoData)
|
||||||
var playerOptions = {
|
var playerOptions = {
|
||||||
id: "url-player-test",
|
id: "url-player-test",
|
||||||
width: '100%', //容器的大小
|
width: '100%', //容器的大小
|
||||||
height: '100%', //容器的大小
|
height: '100%', //容器的大小
|
||||||
"qualitySort": "asc",
|
"qualitySort": "asc",
|
||||||
"cover": "",
|
"cover": "",
|
||||||
"autoplay": true,
|
"autoplay": true,
|
||||||
"isLive": false,
|
"isLive": false,
|
||||||
"rePlay": false,
|
"rePlay": false,
|
||||||
"playsinline": true,
|
"playsinline": true,
|
||||||
"controlBarVisibility": "hover",
|
"controlBarVisibility": "hover",
|
||||||
"useH5Prism": true,
|
"useH5Prism": true,
|
||||||
components: [
|
components: [{
|
||||||
{
|
|
||||||
name: 'adComponent',
|
name: 'adComponent',
|
||||||
type: fullScreenButtonComponent,
|
type: fullScreenButtonComponent,
|
||||||
args: [
|
args: [
|
||||||
@@ -626,6 +716,7 @@
|
|||||||
x: 15,
|
x: 15,
|
||||||
y: 12
|
y: 12
|
||||||
},
|
},
|
||||||
|
// {name: "fullScreenButton", align: "tr", x: 10, y: 12},
|
||||||
{
|
{
|
||||||
name: "volume",
|
name: "volume",
|
||||||
align: "tr",
|
align: "tr",
|
||||||
@@ -656,14 +747,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('这是私有加密的视频');
|
console.log('这是私有加密的视频');
|
||||||
}
|
}
|
||||||
} else if (this.videoData.m3u8Url != null || this.videoData.m3u8Url != '') {
|
} else if (this.videoData.m3u8Url != null || this.videoData.m3u8Url != '') {
|
||||||
playerOptions = {
|
playerOptions = {
|
||||||
...playerOptions,
|
...playerOptions,
|
||||||
source: this.videoData.m3u8Url,
|
source: this.videoData.m3u8Url,
|
||||||
// "playConfig": {"EncryptType": "HLSEncryption"}
|
// "playConfig": {"EncryptType": "HLSEncryption"}
|
||||||
}
|
}
|
||||||
console.log('这是标准加密的视频',this.videoData.id,this.videoData.m3u8Url);
|
console.log('这是标准加密的视频', this.videoData.id, this.videoData.m3u8Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -673,42 +764,64 @@
|
|||||||
}
|
}
|
||||||
console.log('这是没有加密的视频');
|
console.log('这是没有加密的视频');
|
||||||
}
|
}
|
||||||
|
// GolbalPlayerOptions = playerOptions
|
||||||
var player = new Aliplayer(playerOptions, function(player) {});
|
var player = new Aliplayer(playerOptions, function(player) {});
|
||||||
this.player = player;
|
this.player = player;
|
||||||
myplayer = player;
|
myplayer = player;
|
||||||
// console.log('myplayer------------',myplayer.loadByUrl('https://www.w3schools.com/html/movie.mp4'));
|
|
||||||
|
console.log('myplayer------------',JSON.stringify(myplayer));
|
||||||
console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
|
console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
|
||||||
|
|
||||||
player.on('ready', function() {
|
player.on('ready', function() {
|
||||||
|
console.log('播放器准备就绪,开始播放');
|
||||||
|
player.play()
|
||||||
|
})
|
||||||
|
player.on('play', function() {
|
||||||
|
console.log('开始播放------');
|
||||||
|
|
||||||
|
$('.videoContent7').click()
|
||||||
|
|
||||||
})
|
})
|
||||||
player.one('canplay', function() {
|
player.one('canplay', function() {
|
||||||
console.log('这是ios数据缓冲初次设置播放位置判断!!!!',videoData)
|
// console.log('这是ios数据缓冲初次设置播放位置判断!!!!', videoData)
|
||||||
// player.seek(20);
|
// player.seek(20);
|
||||||
player.seek(videoData.firstTime);
|
// if(ReplayVideoFlag){
|
||||||
|
// player.seek(0);
|
||||||
|
// }else{
|
||||||
|
var videoDurationTimes = parseInt(player.getDuration())
|
||||||
|
// var firstTime = parseInt(player.getCurrentTime())
|
||||||
|
console.log('视频总长度',parseInt(player.getDuration()),parseInt(player.getCurrentTime()));
|
||||||
|
if(videoData.firstTime < videoDurationTimes){
|
||||||
|
player.seek(videoData.firstTime);
|
||||||
|
}else{
|
||||||
|
player.seek(0);
|
||||||
|
}
|
||||||
|
//}
|
||||||
})
|
})
|
||||||
this.player.on('playing', function() {
|
this.player.on('playing', function() {
|
||||||
console.log('正在播放')
|
console.log('正在播放...')
|
||||||
|
|
||||||
})
|
})
|
||||||
this.player.on('timeupdate', function() {
|
this.player.on('timeupdate', function() {
|
||||||
let that = this
|
let that = this
|
||||||
var _time = parseInt(player.getCurrentTime())
|
var _time = parseInt(player.getCurrentTime())
|
||||||
curStatus = player.getStatus()
|
curStatus = player.getStatus()
|
||||||
// console.log('timeupdatetimeupdate...',curStatus);
|
// console.log('timeupdatetimeupdate...',curStatus);
|
||||||
if(_seconds != _time){
|
if (_seconds != _time) {
|
||||||
_seconds = _time
|
_seconds = _time
|
||||||
diff ++
|
diff++
|
||||||
if(diff % 60 === 0){
|
if (diff % 60 === 0) {
|
||||||
console.log('符合---------');
|
console.log('符合---------');
|
||||||
$('.videoContent4').click()
|
$('.videoContent4').click()
|
||||||
diff = 0
|
diff = 0
|
||||||
}
|
}
|
||||||
$('.videoContent1').click()
|
$('.videoContent1').click()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.player.on('ended', function() {
|
this.player.on('ended', function() {
|
||||||
console.log('播放完毕');
|
console.log('播放完毕');
|
||||||
$('.videoContent2').click()
|
$('.videoContent2').click()
|
||||||
|
$('.videoContent6').click()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.player.on('error', function() {
|
this.player.on('error', function() {
|
||||||
@@ -742,8 +855,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
receiveScreenType(newValue) {
|
receiveScreenType(newValue) {},
|
||||||
},
|
|
||||||
async receiveIsfresh(newValue) {
|
async receiveIsfresh(newValue) {
|
||||||
|
|
||||||
console.log('是否走了刷新销毁方法:', this.player)
|
console.log('是否走了刷新销毁方法:', this.player)
|
||||||
@@ -768,24 +880,26 @@
|
|||||||
},
|
},
|
||||||
// 监听视频参数变化,并赋值给常量
|
// 监听视频参数变化,并赋值给常量
|
||||||
receiveMsg(newValue, oldValue, ownerVm, vm) {
|
receiveMsg(newValue, oldValue, ownerVm, vm) {
|
||||||
|
|
||||||
//数据变化
|
//数据变化
|
||||||
videoData = newValue
|
videoData = newValue
|
||||||
if(videoData){
|
if (videoData) {
|
||||||
if(videoData.type == 1){
|
console.log('切换后的播放数据videoData',videoData.type);
|
||||||
if(videoData.m3u8Url != '' && videoData.m3u8Url != null){
|
if (videoData.type == 1) {
|
||||||
|
if (videoData.m3u8Url != '' && videoData.m3u8Url != null) {
|
||||||
// myplayer.source(videoData.m3u8Url)
|
// myplayer.source(videoData.m3u8Url)
|
||||||
myplayer.loadByUrl(videoData.m3u8Url)
|
myplayer.loadByUrl(videoData.m3u8Url)
|
||||||
console.log('切换走了吗?m3u8');
|
console.log('切换走了吗?m3u8');
|
||||||
}else{
|
} else {
|
||||||
myplayer.replayByVidAndPlayAuth(videoData.videoId,videoData.playAuth)
|
myplayer.replayByVidAndPlayAuth(videoData.videoId, videoData.playAuth)
|
||||||
console.log('切换走了吗?私有加密');
|
console.log('切换走了吗?私有加密');
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
myplayer.loadByUrl(videoData.m3u8Url)
|
myplayer.loadByUrl(videoData.videoUrl)
|
||||||
console.log('切换常规视频');
|
console.log('切换常规视频');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('可能是切换视频',myplayer,videoData,);
|
// console.log('可能是切换视频', videoData, );
|
||||||
},
|
},
|
||||||
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
|
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
|
||||||
//数据变化
|
//数据变化
|
||||||
@@ -803,7 +917,7 @@
|
|||||||
this.checkValue();
|
this.checkValue();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
console.log('这是这只只是594:', this.firstTime, this.videoData)
|
// console.log('这是这只只是594:', this.firstTime, this.videoData)
|
||||||
this.getLive();
|
this.getLive();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -833,11 +947,49 @@
|
|||||||
document.body.appendChild(l_tag);
|
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-1.0.9.min.js';
|
||||||
|
s_tag.charset = 'utf-8';
|
||||||
|
s_tag.onload = () => {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
document.body.appendChild(s_tag);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
.cancelNext{display: inline-block;
|
||||||
|
border-radius: 10rpx; margin-top: 10rpx;
|
||||||
|
padding: 10rpx 20rpx !important; background-color: #fff !important;
|
||||||
|
color: #000; text-align: center; line-height: 50rpx;}
|
||||||
|
/* .cancelNext:last-child{margin-left: 10rpx;} */
|
||||||
|
.nextText{}
|
||||||
|
.showCountDownd {
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 100%; width: 90%; background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content:flex-end;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 38rpx;
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
top: 0; right: 10rpx;
|
||||||
|
z-index: 4;
|
||||||
|
text{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|||||||
@@ -16,8 +16,11 @@
|
|||||||
<common-video
|
<common-video
|
||||||
@changeScreen="changeScreen"
|
@changeScreen="changeScreen"
|
||||||
@changeScreenLoading="changeScreenLoading"
|
@changeScreenLoading="changeScreenLoading"
|
||||||
|
@hideNextVideo="hideNextVideo"
|
||||||
|
@startNextVideoCountDown = "startNextVideoCountDown"
|
||||||
v-if="isfresh"
|
v-if="isfresh"
|
||||||
ref="commonVideo"
|
ref="commonVideo"
|
||||||
|
:secondCountDown="secondCountDown"
|
||||||
:videoTitle="curriculumData.title"
|
:videoTitle="curriculumData.title"
|
||||||
:currentVideo="currentVideo"
|
:currentVideo="currentVideo"
|
||||||
:noRecored = "noRecored"
|
:noRecored = "noRecored"
|
||||||
@@ -119,6 +122,8 @@ export default {
|
|||||||
isfresh: false,
|
isfresh: false,
|
||||||
currentCateIndex: 0,
|
currentCateIndex: 0,
|
||||||
currentVideo: {},
|
currentVideo: {},
|
||||||
|
secondCountDown:10,
|
||||||
|
countDownTimer:undefined,
|
||||||
videoList: {},
|
videoList: {},
|
||||||
isOpenMp3: false,
|
isOpenMp3: false,
|
||||||
praise: "",
|
praise: "",
|
||||||
@@ -206,22 +211,13 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy(){
|
beforeDestroy(){
|
||||||
console.log('页面卸载')
|
console.log('页面卸载')
|
||||||
|
this.hideNextVideo()
|
||||||
// this.$nextTick(()=>{
|
|
||||||
// this.$refs.commonVideo.handleEnd();
|
|
||||||
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
onUnload(){
|
onUnload(){
|
||||||
// console.log('页面卸载')
|
|
||||||
|
|
||||||
// // this.$nextTick(()=>{
|
|
||||||
// this.$refs.commonVideo.handleEnd();
|
|
||||||
|
|
||||||
// // })
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
|
// this.hideNextVideo()
|
||||||
// this.showSearchList = false
|
// this.showSearchList = false
|
||||||
// this.searchList = []
|
// this.searchList = []
|
||||||
},
|
},
|
||||||
@@ -232,7 +228,33 @@ export default {
|
|||||||
...mapState(["userInfo"]),
|
...mapState(["userInfo"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 放大图片
|
startNextVideoCountDown(){
|
||||||
|
this.secondCountDown = 10
|
||||||
|
let that = this
|
||||||
|
if(this.countDownTimer){
|
||||||
|
clearInterval(this.countDownTimer)
|
||||||
|
}
|
||||||
|
this.countDownTimer = setInterval(()=>{
|
||||||
|
this.secondCountDown -= 1
|
||||||
|
if(this.secondCountDown == 0){
|
||||||
|
// clearInterval(this.countDownTimer)
|
||||||
|
// console.log('倒计时结束');
|
||||||
|
that.hideNextVideo()
|
||||||
|
console.log('切换之前的播放index是',this.currentCateIndex);
|
||||||
|
// console.log('当前的播放列表',this.videoArray.length);
|
||||||
|
// if(this.currentCateIndex < this.videoArray.length-1){
|
||||||
|
this.currentCateIndex++
|
||||||
|
console.log('切换之后的播放index是',this.currentCateIndex);
|
||||||
|
that.changeVideo(this.videoArray[this.currentCateIndex])
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
},1000)
|
||||||
|
},
|
||||||
|
hideNextVideo(){
|
||||||
|
console.log('父组件收到了取消加载-------------------');
|
||||||
|
clearInterval(this.countDownTimer)
|
||||||
|
this.countDownTimer = undefined
|
||||||
|
},
|
||||||
|
|
||||||
//课程详情
|
//课程详情
|
||||||
async gotoDetail(v, index) {
|
async gotoDetail(v, index) {
|
||||||
@@ -279,9 +301,16 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeVideo(data) {
|
changeVideo(data) {
|
||||||
console.log("点击了点击了切换视频-----:", data);
|
if(this.countDownTimer){
|
||||||
|
this.hideNextVideo()
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("点击了点击了切换视频-----:", this.countDownTimer,data, );
|
||||||
|
|
||||||
if (data.id != this.currentVideo.id) {
|
if (data.id != this.currentVideo.id) {
|
||||||
|
this.currentCateIndex = this.videoArray.findIndex(item => {
|
||||||
|
return item.id == data.id
|
||||||
|
})
|
||||||
// handleEnd
|
// handleEnd
|
||||||
// this.$refs.commonVideo.handleEnd();
|
// this.$refs.commonVideo.handleEnd();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
" @click="isHideCourseInfo = !isHideCourseInfo">
|
" @click="isHideCourseInfo = !isHideCourseInfo">
|
||||||
<view :class="`${isHideCourseInfo ? 'hidden2' : ''}`"
|
<view :class="`${isHideCourseInfo ? 'hidden2' : ''}`"
|
||||||
style="width: calc(100% - 50rpx)" v-html="course.content">
|
style="width: calc(100% - 50rpx); font-size: 30rpx;" v-html="course.content">
|
||||||
</view>
|
</view>
|
||||||
<!-- <text
|
<!-- <text
|
||||||
style="
|
style="
|
||||||
|
|||||||
5932
static/aliplayercomponents-1.0.9.min.js
vendored
Normal file
5932
static/aliplayercomponents-1.0.9.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user