安卓可以播
This commit is contained in:
@@ -12,13 +12,19 @@
|
||||
"src" : "图片路径"
|
||||
}
|
||||
],
|
||||
"versionName" : "1.0.05",
|
||||
"versionCode" : 100,
|
||||
"versionName" : "1.0.07",
|
||||
"versionCode" : 1007,
|
||||
"app-plus" : {
|
||||
"nvueCompiler" : "weex",
|
||||
"compatible" : {
|
||||
"ignoreVersion" : true
|
||||
},
|
||||
"screenOrientation" : [
|
||||
"portrait-primary",
|
||||
"portrait-secondary",
|
||||
"landscape-primary",
|
||||
"landscape-secondary"
|
||||
],
|
||||
"privacy" : {
|
||||
"prompt" : "template",
|
||||
"template" : {
|
||||
|
||||
@@ -366,12 +366,21 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
// ios课程播放
|
||||
"path": "pages/course/chapterDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "章节详情",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
// Andriod课程播放
|
||||
"path": "pages/course/chapterDetailAndorid",
|
||||
"style": {
|
||||
"navigationBarTitleText": "章节详情",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/course/courseSet",
|
||||
"style": {
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import store from "@/store/index.js";
|
||||
import $http from "@/config/requestConfig.js";
|
||||
import {
|
||||
mapState,
|
||||
@@ -89,7 +90,12 @@
|
||||
},
|
||||
},
|
||||
// //页面显示
|
||||
mounted() {},
|
||||
mounted() {
|
||||
clearInterval(this.$store.state.videoTimer);
|
||||
clearInterval(this.videoTimer);
|
||||
this.videoTimer = null;
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
},
|
||||
async onUnload() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/curriculum/order/curriculum/back",
|
||||
@@ -221,22 +227,28 @@
|
||||
this.firstTime = 0;
|
||||
}
|
||||
}
|
||||
this.currentTime = this.firstTime;
|
||||
// this.currentTime = this.firstTime;
|
||||
console.log(this.firstTime, "这是第一次播放时长222",this.noRecored);
|
||||
await this.setVideoTime();
|
||||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||||
|
||||
if (this.currentVideo.type == 0 || this.currentVideo.type == 2) {
|
||||
await this.playVideo();
|
||||
}
|
||||
|
||||
console.log(this.firstTime, "这是第一次播放时长");
|
||||
this.isSetFirstTime = true;
|
||||
|
||||
if (this.currentVideo.type == 0 || this.currentVideo.type == 2) {
|
||||
await this.playVideo();
|
||||
}
|
||||
}
|
||||
},
|
||||
async playVideo(e) {
|
||||
this.videoContext = uni.createVideoContext("videoId", this);
|
||||
this.videoContext.seek(this.firstTime);
|
||||
|
||||
if (this.isSetFirstTime) {
|
||||
setTimeout((res) => {
|
||||
this.videoContext.seek(this.firstTime);
|
||||
this.setVideoFirtsetTime();
|
||||
}, 100);
|
||||
}
|
||||
// this.videoContext.requestFullScreen();
|
||||
},
|
||||
recordTime(data) {
|
||||
@@ -283,6 +295,7 @@
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
|
||||
if (this.currentVideo.type == 1) {
|
||||
var playAuth = res.video.playAuth.replace(/=/g, "");
|
||||
this.videoData = {
|
||||
@@ -314,8 +327,10 @@
|
||||
var data = list.find((e) => e.id == this.videoData.id);
|
||||
this.currentTime = data.time;
|
||||
console.log('this.currentTime at line 这是结束的时候掉的存储视频:', this.currentTime)
|
||||
await this.setVideoTime();
|
||||
clearInterval(this.$store.state.videoTimer);
|
||||
this.timer = null;
|
||||
await this.setVideoTime();
|
||||
|
||||
},
|
||||
setVideoTime(time) {
|
||||
let thisBlur = JSON.parse(this.noRecored)
|
||||
@@ -329,7 +344,7 @@
|
||||
videoId: this.videoData.id,
|
||||
position: this.currentTime, //秒数
|
||||
};
|
||||
|
||||
return
|
||||
$http
|
||||
.request({
|
||||
url: `sociology/course/saveCoursePosition`,
|
||||
@@ -354,6 +369,19 @@
|
||||
delta: 1,
|
||||
});
|
||||
},
|
||||
async setVideoFirtsetTime(time) {
|
||||
this.currentTime = this.firstTime;
|
||||
console.log("这里准备开始设置播放时间:", this.currentTime);
|
||||
store.commit(
|
||||
"setVideoTimer",
|
||||
setInterval(async () => {
|
||||
// if (this.currentTime) {
|
||||
await this.setVideoTime();
|
||||
// }
|
||||
}, 60000)
|
||||
);
|
||||
// }, 5000);
|
||||
},
|
||||
},
|
||||
|
||||
created() {},
|
||||
@@ -394,7 +422,6 @@
|
||||
|
||||
watch: {
|
||||
|
||||
|
||||
curTime(val) {
|
||||
console.log('val at line 这是真正的时长:', val)
|
||||
if (this.curTime !== null && this.curStatus !== null) {
|
||||
@@ -847,9 +874,6 @@
|
||||
},
|
||||
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';
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
:src="videoData.type==1?videoData.m3u8Url:videoData.videoUrl" autoplay="true" duration=""
|
||||
enable-danmu="true" :loop="true" :title="videoTitle" @click="" initial-time="" direction="-90" show-mute-btn="true"
|
||||
@play="onstart" @pause="onpause" @ended="onfinish" @error="onfail" @waiting="waiting"
|
||||
@timeupdate="timeupdate" @fullscreenchange="fullscreenchange">
|
||||
<cover-view v-show="speedState && !mode" style="position: absolute; padding: 10rpx !important; background-color:rgba(0, 0, 0, .8); color: #fff; top: 30rpx; right: 30rpx;"
|
||||
@timeupdate="timeupdate" @fullscreenchange="fullscreenchange" >
|
||||
<!-- <cover-view v-show="speedState && !mode" style="position: absolute; padding: 10rpx !important; background-color:rgba(0, 0, 0, .8); color: #fff; top: 30rpx; right: 30rpx;"
|
||||
@click="beisuClick()">{{beisuText}}</cover-view>
|
||||
<cover-view v-show="mode && speedState" style="position: absolute; color: #fff; top: 30rpx; right: 30rpx;">
|
||||
<cover-view class="speedList" v-for="(item, index) in playbackRateList" :key="index">
|
||||
<cover-view :class="['speedItem',speedIndex == index ? 'active' : '']" @click="doubleSpeed(item.value, index)">x{{item.value}}</cover-view>
|
||||
</cover-view>
|
||||
</cover-view>
|
||||
</cover-view> -->
|
||||
</video>
|
||||
|
||||
<!-- <div
|
||||
@@ -177,7 +177,7 @@
|
||||
// #ifdef APP-PLUS
|
||||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||||
clearTimeout(this.beisuShowTimer)
|
||||
// plus.screen.lockOrientation("portrait-primary");
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
// #endif
|
||||
|
||||
// this.player.dispose();
|
||||
@@ -225,6 +225,12 @@
|
||||
},
|
||||
fullscreenchange(e) {
|
||||
console.log("fullscreenchange全屏:" + JSON.stringify(e));
|
||||
if(!e.detail.fullScreen){
|
||||
console.log('取消全屏');
|
||||
// #ifdef APP-PLUS
|
||||
plus.screen.lockOrientation('portrait-primary');
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
waiting(e) {
|
||||
console.log("waiting:" + JSON.stringify(e));
|
||||
|
||||
1407
pages/course/chapterDetailAndorid.vue
Normal file
1407
pages/course/chapterDetailAndorid.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -481,7 +481,8 @@
|
||||
goodsList: "sociology/product/getProductListForCourse",
|
||||
startStudyForMF: "sociology/course/startStudyForMF",
|
||||
},
|
||||
isAndorid: true
|
||||
isAndorid: true,
|
||||
oprateOsName:'',
|
||||
};
|
||||
},
|
||||
//第一次加载
|
||||
@@ -557,7 +558,8 @@
|
||||
getOS() {
|
||||
let oprateOs = "";
|
||||
oprateOs = uni.getSystemInfoSync().platform;
|
||||
// console.log(oprateOs)
|
||||
this.oprateOsName = uni.getSystemInfoSync().platform;
|
||||
console.log('oprateOs',oprateOs)
|
||||
if (oprateOs == "android") {
|
||||
this.isAndorid = true;
|
||||
} else {
|
||||
@@ -637,13 +639,20 @@
|
||||
async gotoDetail(v, courseIndex) {
|
||||
console.log("准备进入学习页面", v);
|
||||
this.currentCateIndex = courseIndex;
|
||||
let _myurl = ''
|
||||
if(this.oprateOsName == 'ios'){
|
||||
_myurl = '/pages/course/chapterDetail'
|
||||
}else{
|
||||
// h5 和安卓
|
||||
_myurl = '/pages/course/chapterDetailAndorid'
|
||||
}
|
||||
if (this.librayList[this.curIndex].isBuy == 1 || v.isAudition == 1 ||
|
||||
this.vip.type != "0") {
|
||||
let noRecored = false
|
||||
v.isAudition == 1 && this.userMsg.vip == 0 && this.librayList[this.curIndex].isBuy == 0 ?
|
||||
noRecored = true : ''
|
||||
uni.navigateTo({
|
||||
url: `/pages/course/chapterDetail?navTitle=${this.pageTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&noRecored=${noRecored}`,
|
||||
url: `${_myurl}?navTitle=${this.pageTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&noRecored=${noRecored}`,
|
||||
});
|
||||
} else {
|
||||
this.$commonJS.showToast("请先购买课程");
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user