提交
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
"src" : "图片路径"
|
"src" : "图片路径"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"versionName" : "1.0.07",
|
"versionName" : "1.0.09",
|
||||||
"versionCode" : 1007,
|
"versionCode" : 1009,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"nvueCompiler" : "weex",
|
"nvueCompiler" : "weex",
|
||||||
"compatible" : {
|
"compatible" : {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
// importScripts('@/static/aliplayer/aliplayer-min.js')
|
// importScripts('@/static/aliplayer/aliplayer-min.js')
|
||||||
export default {
|
export default {
|
||||||
props: ["currentVideo", "currentVideoList",'noRecored'],
|
props: ["currentVideo", "currentVideoList", 'noRecored'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// noRecored 为true时候不记录播放时长
|
// noRecored 为true时候不记录播放时长
|
||||||
@@ -77,7 +77,8 @@
|
|||||||
isSetFirstTime: false,
|
isSetFirstTime: false,
|
||||||
screenType: null,
|
screenType: null,
|
||||||
videoUrl: null,
|
videoUrl: null,
|
||||||
num:0,
|
num: 0,
|
||||||
|
oprateOsName:''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -90,11 +91,18 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
// //页面显示
|
// //页面显示
|
||||||
mounted() {
|
mounted() {this.getOS()},
|
||||||
|
async beforeDestroy() {
|
||||||
|
this.handleEnd();
|
||||||
|
console.log("是否走啦习销毁");
|
||||||
clearInterval(this.$store.state.videoTimer);
|
clearInterval(this.$store.state.videoTimer);
|
||||||
clearInterval(this.videoTimer);
|
clearInterval(this.videoTimer);
|
||||||
this.videoTimer = null;
|
this.videoTimer = null;
|
||||||
|
// store.commit("setLoadingShow", null);
|
||||||
plus.screen.lockOrientation("portrait-primary");
|
plus.screen.lockOrientation("portrait-primary");
|
||||||
|
|
||||||
|
console.log("是否走啦习销毁定时器", this.timer);
|
||||||
|
await this.setVideoTime();
|
||||||
},
|
},
|
||||||
async onUnload() {
|
async onUnload() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -106,9 +114,9 @@
|
|||||||
// plus.screen.lockOrientation("portrait-primary");
|
// plus.screen.lockOrientation("portrait-primary");
|
||||||
// #endif
|
// #endif
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
|
|
||||||
await this.setVideoTime();
|
await this.setVideoTime();
|
||||||
|
|
||||||
this.player.dispose();
|
this.player.dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -116,7 +124,7 @@
|
|||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log(options, "这是传参");
|
console.log(options, "这是传参");
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
plus.screen.unlockOrientation();
|
plus.screen.unlockOrientation();
|
||||||
plus.screen.lockOrientation("landscape-primary");
|
plus.screen.lockOrientation("landscape-primary");
|
||||||
@@ -137,17 +145,21 @@
|
|||||||
|
|
||||||
this.videoId = this.options.video;
|
this.videoId = this.options.video;
|
||||||
|
|
||||||
this.timer = setInterval(() => {
|
// this.timer = setInterval(() => {
|
||||||
var that = this;
|
// var that = this;
|
||||||
if (this.currentTime) {
|
// if (this.currentTime) {
|
||||||
|
|
||||||
that.setVideoTime();
|
// that.setVideoTime();
|
||||||
}
|
// }
|
||||||
}, 60000);
|
// }, 60000);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获得操作系统
|
||||||
|
getOS() {
|
||||||
|
this.oprateOsName = uni.getSystemInfoSync().platform;
|
||||||
|
},
|
||||||
screenChange(data) {
|
screenChange(data) {
|
||||||
console.log(
|
console.log(
|
||||||
"status at line 这是当前的状态158:",
|
"status at line 这是当前的状态158:",
|
||||||
@@ -194,17 +206,17 @@
|
|||||||
}
|
}
|
||||||
this.options = data.currentVideo;
|
this.options = data.currentVideo;
|
||||||
console.log("this.options at line 64:", this.options);
|
console.log("this.options at line 64:", this.options);
|
||||||
this.videoId = this.options.video;
|
this.videoId = this.options.video;
|
||||||
this.timer = setInterval(async () => {
|
// this.timer = setInterval(async () => {
|
||||||
var that = this;
|
// var that = this;
|
||||||
if (this.currentTime) {
|
// if (this.currentTime) {
|
||||||
console.log('我是init定义的定时');
|
// console.log('我是init定义的定时');
|
||||||
await that.setVideoTime();
|
// await that.setVideoTime();
|
||||||
}
|
// }
|
||||||
}, 60000);
|
// }, 60000);
|
||||||
await this.getLive();
|
await this.getLive();
|
||||||
},
|
},
|
||||||
async getData(data) {
|
async getData(data) {
|
||||||
if (!this.isSetFirstTime) {
|
if (!this.isSetFirstTime) {
|
||||||
var netWork = this.videoData.userCourseVideoPositionEntity ?
|
var netWork = this.videoData.userCourseVideoPositionEntity ?
|
||||||
this.videoData.userCourseVideoPositionEntity.position :
|
this.videoData.userCourseVideoPositionEntity.position :
|
||||||
@@ -227,30 +239,35 @@
|
|||||||
this.firstTime = 0;
|
this.firstTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.currentTime = this.firstTime;
|
|
||||||
console.log(this.firstTime, "这是第一次播放时长222",this.noRecored);
|
this.currentTime = this.firstTime;
|
||||||
await this.setVideoTime();
|
console.log(this.firstTime, "这是第一次播放时长222", this.noRecored);
|
||||||
|
await this.setVideoTime();
|
||||||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||||||
|
|
||||||
|
|
||||||
console.log(this.firstTime, "这是第一次播放时长");
|
console.log(this.firstTime, "这是第一次播放时长");
|
||||||
this.isSetFirstTime = true;
|
this.isSetFirstTime = true;
|
||||||
|
|
||||||
if (this.currentVideo.type == 0 || this.currentVideo.type == 2) {
|
|
||||||
await this.playVideo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async playVideo(e) {
|
|
||||||
this.videoContext = uni.createVideoContext("videoId", this);
|
|
||||||
if (this.isSetFirstTime) {
|
|
||||||
setTimeout((res) => {
|
setTimeout((res) => {
|
||||||
this.videoContext.seek(this.firstTime);
|
// this.videoContext.seek(this.firstTime);
|
||||||
|
// this.player.seek(this.firstTime);
|
||||||
this.setVideoFirtsetTime();
|
this.setVideoFirtsetTime();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
// if (this.currentVideo.type == 0 || this.currentVideo.type == 2 ) {
|
||||||
|
// await this.playVideo();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
// this.videoContext.requestFullScreen();
|
|
||||||
},
|
},
|
||||||
|
// async playVideo(e) {
|
||||||
|
// this.videoContext = uni.createVideoContext("videoId", this);
|
||||||
|
// if (this.isSetFirstTime) {
|
||||||
|
// setTimeout((res) => {
|
||||||
|
// this.videoContext.seek(this.firstTime);
|
||||||
|
// this.setVideoFirtsetTime();
|
||||||
|
// }, 100);
|
||||||
|
// }
|
||||||
|
// // this.videoContext.requestFullScreen();
|
||||||
|
// },
|
||||||
recordTime(data) {
|
recordTime(data) {
|
||||||
this.currentTime = data.time;
|
this.currentTime = data.time;
|
||||||
|
|
||||||
@@ -275,7 +292,7 @@
|
|||||||
|
|
||||||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||||||
|
|
||||||
console.log(list, "走接口的方法参数");
|
// console.log(list, "走接口的方法参数");
|
||||||
},
|
},
|
||||||
// 获取数据
|
// 获取数据
|
||||||
getLive() {
|
getLive() {
|
||||||
@@ -295,7 +312,25 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
console.log('res',this.oprateOsName, res);
|
||||||
|
if (this.oprateOsName == 'ios') {
|
||||||
|
console.log('不符合播放条件');
|
||||||
|
if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo.type == 1 && res.video.m3u8Url == '') {
|
||||||
|
// 只存在私有加密
|
||||||
|
uni.showModal({
|
||||||
|
content: '抱歉,苹果手机不支持此加密视频格式,您可以在安卓端观看本视频',
|
||||||
|
confirmText: '知道了',
|
||||||
|
showCancel: false,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateBack({delta: 2})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo.type == 1 && res.video.m3u8Url == '') {
|
||||||
if (this.currentVideo.type == 1) {
|
if (this.currentVideo.type == 1) {
|
||||||
var playAuth = res.video.playAuth.replace(/=/g, "");
|
var playAuth = res.video.playAuth.replace(/=/g, "");
|
||||||
this.videoData = {
|
this.videoData = {
|
||||||
@@ -304,8 +339,21 @@
|
|||||||
playAuth: playAuth,
|
playAuth: playAuth,
|
||||||
};
|
};
|
||||||
this.playAuth = playAuth;
|
this.playAuth = playAuth;
|
||||||
} else {
|
}
|
||||||
|
// else if(this.currentVideo.type == 1 && res.video.m3u8Url != null || this.currentVideo.type == 1 && res.video.m3u8Url != ''){
|
||||||
|
// this.videoData = {
|
||||||
|
// ...res.video,
|
||||||
|
// playAuth: new Date().getTime(),
|
||||||
|
|
||||||
|
// };
|
||||||
|
// this.videoUrl =
|
||||||
|
// res.video.m3u8Url;
|
||||||
|
// console.log('这是m3u8加密的视频');
|
||||||
|
// this.$nextTick(async () => {
|
||||||
|
// await this.getData();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
else {
|
||||||
this.videoData = {
|
this.videoData = {
|
||||||
...res.video,
|
...res.video,
|
||||||
playAuth: new Date().getTime()
|
playAuth: new Date().getTime()
|
||||||
@@ -313,7 +361,7 @@
|
|||||||
this.videoUrl =
|
this.videoUrl =
|
||||||
// "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" +
|
// "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/" +
|
||||||
res.video.videoUrl;
|
res.video.videoUrl;
|
||||||
console.log('这是常规视频');
|
console.log('这是常规视频');
|
||||||
// this.$nextTick(async () => {
|
// this.$nextTick(async () => {
|
||||||
// await this.getData();
|
// await this.getData();
|
||||||
// });
|
// });
|
||||||
@@ -329,22 +377,22 @@
|
|||||||
console.log('this.currentTime at line 这是结束的时候掉的存储视频:', this.currentTime)
|
console.log('this.currentTime at line 这是结束的时候掉的存储视频:', this.currentTime)
|
||||||
clearInterval(this.$store.state.videoTimer);
|
clearInterval(this.$store.state.videoTimer);
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
await this.setVideoTime();
|
await this.setVideoTime();
|
||||||
|
|
||||||
},
|
},
|
||||||
setVideoTime(time) {
|
setVideoTime(time) {
|
||||||
let thisBlur = JSON.parse(this.noRecored)
|
let thisBlur = JSON.parse(this.noRecored)
|
||||||
if(thisBlur){
|
if (thisBlur) {
|
||||||
console.log('本条视频不记录播放记录,是未购买且试听章节',thisBlur);
|
console.log('本条视频不记录播放记录,是未购买且试听章节', thisBlur);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('本条视频需要记录播放时长',thisBlur);
|
console.log('本条视频需要记录播放时长', thisBlur);
|
||||||
console.log("是否走了存储视屏," + this.videoData.id, this.currentTime, );
|
console.log("是否走了存储视屏," + this.videoData.id, this.currentTime, );
|
||||||
var data = {
|
var data = {
|
||||||
videoId: this.videoData.id,
|
videoId: this.videoData.id,
|
||||||
position: this.currentTime, //秒数
|
position: this.currentTime, // 秒数
|
||||||
};
|
};
|
||||||
return
|
console.log('data-------', data);
|
||||||
$http
|
$http
|
||||||
.request({
|
.request({
|
||||||
url: `sociology/course/saveCoursePosition`,
|
url: `sociology/course/saveCoursePosition`,
|
||||||
@@ -358,6 +406,8 @@
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log('存储视屏时长接口返回信息', res)
|
console.log('存储视屏时长接口返回信息', res)
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
|
}).catch(e => {
|
||||||
|
console.log('存储进度接口报错', e)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changePlayerTime(player) {
|
changePlayerTime(player) {
|
||||||
@@ -371,7 +421,7 @@
|
|||||||
},
|
},
|
||||||
async setVideoFirtsetTime(time) {
|
async setVideoFirtsetTime(time) {
|
||||||
this.currentTime = this.firstTime;
|
this.currentTime = this.firstTime;
|
||||||
console.log("这里准备开始设置播放时间:", this.currentTime);
|
console.log("这里准备开始设置播放时间:", this.currentTime);
|
||||||
store.commit(
|
store.commit(
|
||||||
"setVideoTimer",
|
"setVideoTimer",
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
@@ -415,6 +465,7 @@
|
|||||||
player: null,
|
player: null,
|
||||||
curTime: null,
|
curTime: null,
|
||||||
curStatus: null,
|
curStatus: null,
|
||||||
|
firstTime: null,
|
||||||
// currentTime:null,
|
// currentTime:null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -706,7 +757,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.videoData.type == 1) {
|
if (this.videoData.type == 1 && this.videoData.m3u8Url == null || this.videoData.type == 1 && this
|
||||||
|
.videoData.m3u8Url == '') {
|
||||||
playerOptions = {
|
playerOptions = {
|
||||||
...playerOptions,
|
...playerOptions,
|
||||||
"playauth": this.videoData.playAuth, // 必选参数,参数值可通过调用GetVideoPlayAuth接口获取。
|
"playauth": this.videoData.playAuth, // 必选参数,参数值可通过调用GetVideoPlayAuth接口获取。
|
||||||
@@ -715,12 +767,24 @@
|
|||||||
"EncryptType": 'AliyunVoDEncryption'
|
"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": 'AliyunVoDEncryption'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('这是标准加密的视频');
|
||||||
} else {
|
} else {
|
||||||
playerOptions = {
|
playerOptions = {
|
||||||
...playerOptions,
|
...playerOptions,
|
||||||
source: this.videoData.videoUrl
|
source: this.videoData.videoUrl
|
||||||
}
|
}
|
||||||
|
console.log('这是没有加密的视频');
|
||||||
}
|
}
|
||||||
var player = new Aliplayer(playerOptions, function(player) {
|
var player = new Aliplayer(playerOptions, function(player) {
|
||||||
|
|
||||||
@@ -740,8 +804,14 @@
|
|||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
// player.on('ready',function(){
|
// player.on('ready',function(){
|
||||||
// player.fullscreenService.requestFullScreen()
|
// // this.firstTime = 20
|
||||||
|
// console.log('播放器准备完毕',this.firstTime);
|
||||||
|
|
||||||
|
// // player.fullscreenService.requestFullScreen()
|
||||||
|
// if (this.firstTime > 0) {
|
||||||
|
// console.log('进入seek了吗?',this.firstTime)
|
||||||
|
// player.seek(this.firstTime);
|
||||||
|
// }
|
||||||
// })
|
// })
|
||||||
this.player.on('ended', function() {
|
this.player.on('ended', function() {
|
||||||
console.log('that.curTime at line 242:', this.curTime)
|
console.log('that.curTime at line 242:', this.curTime)
|
||||||
@@ -805,12 +875,12 @@
|
|||||||
async receiveIsfresh(newValue) {
|
async receiveIsfresh(newValue) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
if (this.player) {
|
if (this.player) {
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
|
|
||||||
await this.setVideoTime();
|
await this.setVideoTime();
|
||||||
|
|
||||||
this.player.dispose();
|
this.player.dispose();
|
||||||
// this.player.seek(newValue);
|
this.player.seek(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('newValue at line 427屏幕方向111111111111:', newValue)
|
console.log('newValue at line 427屏幕方向111111111111:', newValue)
|
||||||
@@ -818,14 +888,15 @@
|
|||||||
},
|
},
|
||||||
receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
||||||
// //数据变化
|
// //数据变化
|
||||||
|
this.firstTime = newValue
|
||||||
console.log('newValue111', newValue)
|
console.log('第一次播放的值', newValue, this.player)
|
||||||
|
|
||||||
console.log('vm4444', vm)
|
console.log('vm4444', vm)
|
||||||
console.log('this.firstTime at line 215:', newValue)
|
console.log('this.firstTime at line 215:', newValue)
|
||||||
if (this.player) {
|
// if (this.player) {
|
||||||
this.player.seek(newValue);
|
// console.log('进入seek了吗?')
|
||||||
}
|
// this.player.seek(newValue);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ export default {
|
|||||||
? this.options.videoIndex
|
? this.options.videoIndex
|
||||||
: 0;
|
: 0;
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
plus.screen.unlockOrientation(); //解除锁定屏幕方向
|
plus.screen.unlockOrientation(); // 解除锁定屏幕方向
|
||||||
plus.screen.lockOrientation("portrait-primary");
|
plus.screen.lockOrientation("portrait-primary");
|
||||||
|
|
||||||
this.getCourseDescriptionData();
|
this.getCourseDescriptionData();
|
||||||
@@ -362,10 +362,10 @@ export default {
|
|||||||
onUnload(){
|
onUnload(){
|
||||||
console.log('页面卸载')
|
console.log('页面卸载')
|
||||||
|
|
||||||
this.$nextTick(()=>{
|
// this.$nextTick(()=>{
|
||||||
this.$refs.commonVideo.handleEnd();
|
this.$refs.commonVideo.handleEnd();
|
||||||
|
|
||||||
})
|
// })
|
||||||
|
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
|
|||||||
@@ -640,12 +640,12 @@
|
|||||||
console.log("准备进入学习页面", v);
|
console.log("准备进入学习页面", v);
|
||||||
this.currentCateIndex = courseIndex;
|
this.currentCateIndex = courseIndex;
|
||||||
let _myurl = ''
|
let _myurl = ''
|
||||||
if(this.oprateOsName == 'ios'){
|
// if(this.oprateOsName == 'ios'){
|
||||||
_myurl = '/pages/course/chapterDetail'
|
// _myurl = '/pages/course/chapterDetail'
|
||||||
}else{
|
// }else{
|
||||||
// h5 和安卓
|
// h5 和安卓
|
||||||
_myurl = '/pages/course/chapterDetailAndorid'
|
_myurl = '/pages/course/chapterDetailAndorid'
|
||||||
}
|
// }
|
||||||
if (this.librayList[this.curIndex].isBuy == 1 || v.isAudition == 1 ||
|
if (this.librayList[this.curIndex].isBuy == 1 || v.isAudition == 1 ||
|
||||||
this.vip.type != "0") {
|
this.vip.type != "0") {
|
||||||
let noRecored = false
|
let noRecored = false
|
||||||
|
|||||||
Reference in New Issue
Block a user