提交 b72d5486 authored 作者: 何喜's avatar 何喜

特定人员,首次不让改变进度

上级 43f2f66c
......@@ -113,7 +113,8 @@ const getCurrentChapterDetail = (vid, videoType,callback) => {
current: 0,
selectIndex: 0,
timeArr: res.data.ppts && res.data.ppts.map(function (_, i) { return _.ppt_point })
}
},
'is_locked': res.data.is_locked
}
callback(json)
}
......
......@@ -3,6 +3,6 @@
<view class='content-video'
style='{{status.isSet && status.isVideo ? "display: none;" : "" }} {{status.isImages && status.isVideo ? "display: none;" : "" }} {{status.isAudio ? "display: none;" : "" }} {{chapterList.isShow && status.isVideo ? "display: none;" : "" }} {{ status.isLoading ? "display: none": "" }}'
>
<video id='my-video' class='my-video' src='{{video.src}}' show-center-play-btn='{{false}}' controls='{{false}}' bindtimeupdate='timeUpdate' bindfullscreenchange='beginAndOutFullScreen' bindpause='beginPauseVA' bindplay='beginPlayVA' binderror='playError' bindended='playEnded' autoplay='{{true}}'></video>
<video id='my-video' class='my-video' src='{{video.src}}' show-center-play-btn='{{false}}' controls='{{false}}' bindtimeupdate='timeUpdate' bindfullscreenchange='beginAndOutFullScreen' enable-progress-gesture='{{!status.disable}}' bindpause='beginPauseVA' bindplay='beginPlayVA' binderror='playError' bindended='playEnded' autoplay='{{true}}'></video>
</view>
</template>
\ No newline at end of file
......@@ -36,7 +36,7 @@
<image class='img' src='./controlBar/icons/btn-front.png' mode='scaleToFill' data-id='{{chapterList.nextVideo.id}}' data-hasVA='{{chapterList.nextVideo.time}}' data-name='{{chapterList.nextVideo.name}}' data-type='{{chapterList.nextVideo.videoType}}' bindtap='nextChapter'></image>
</view>
</view>
<view class='right-btn' bindtap='openSetContent'>
<view class='right-btn' style="display:{{status.disable ? 'none': 'block'}}" bindtap='openSetContent'>
<image class='img' src='./controlBar/icons/see-set.png' mode='scaleToFill'></image>
<view class='text'>设置</view>
</view>
......
......@@ -27,6 +27,7 @@ Page({
isImages: false, // 是否播放图片
isVideo: false, // 是否播放视频,独立存在,永远存在,只用isVideo属性控制
imagesLoaded: false, // 图片是否加载完
disable: true, // 是否禁止点击进度条
},
/* 视频地址 */
video: {
......@@ -59,7 +60,8 @@ Page({
progress: '0%', // 播放百分比率
curRate: '1.0X', // 当前播放倍率
jumpFlag: false, // 是否跳过片头
vid: 0 // 当前视频对应的 vid
vid: 0, // 当前视频对应的 vid
cumulativeDuration: '', // 累计播放时长
},
/* 课程章节列表 */
chapterList: {
......@@ -110,9 +112,7 @@ Page({
initPage: function (res, vid) {
/* 默认先 显示视频 */
this.setData({ 'status.isVideo': true })
this._cache = { isPlay: false, initial_time: 0, currentTime: '00:00', totalTime: '00:00', progress: '0%', curRate: '1.0X', jumpFlag: false, vid: vid }
/* 加载中时,重置控制内容 全部为 0 */
this.setData({ 'ctrlBar': this._cache })
this._cache = { isPlay: false, initial_time: 0, currentTime: '00:00', totalTime: '00:00', progress: '0%', curRate: '1.0X', jumpFlag: false, vid: vid, cumulativeDuration:'' }
/* 一定会 存在值 */
if (res) {
let tempVid = wx.getStorageSync('videoCacheCtrlBar').vid
......@@ -121,8 +121,12 @@ Page({
res.cpt = Math.max(this._cache.initial_time || '', res.cpt)
}
this._cache.initial_time = res.cpt
this._cache.cumulativeDuration = res.mpt
this.realTimeProgress = res
}
/* 加载中时,重置控制内容 全部为 0 */
this.setData({ 'ctrlBar': this._cache })
wx.setStorageSync('videoCacheCtrlBar', this._cache);
wx.setStorageSync('audioCacheCtrlBar', this._cache);
/* 将旧的对象全部抛弃掉 */
......@@ -149,6 +153,9 @@ Page({
})
// CC视频走这个接口
ChapterApi.getCurrentChapterDetail(vid,videoType, (json) => {
if(!json.is_locked && this.data.status.disable){
this.setData({ 'status.disable': false })
}
// 播放的视频数据
this.setData({ 'video': json.video })
this.setData({ 'audio': json.audio })
......@@ -304,7 +311,7 @@ Page({
this.setData({ 'ctrlBar.isPlay': true })
_status.isVideo && this._video.play();
_status.isAudio && this._audio.play();
this.setHeartbeat()
this.setHeartbeat()
},
/* controlBar页面 - 暂停音视频 - bindTap事件和内部调用 */
pauseVA: function () {
......@@ -315,7 +322,10 @@ Page({
clearInterval(this.heartbeat)
},
/* controlBar页面 - 点击进度条跳到某个位置播放 - bindtouchstart事件 */
tapToSeek: function (e) { let pLine = wx.getSystemInfoSync().windowWidth - e.currentTarget.offsetLeft * 2, pos = e.touches[0].pageX, _data = this.data, _status = _data.status, _obj = _status.isVideo ? this._video : this._audio; this.seekVA(parseInt(pos / pLine * _obj.totalTime)); },
tapToSeek: function (e) {
// 第一次不让滑动视频
if(this.data.status.disable) return;
let pLine = wx.getSystemInfoSync().windowWidth - e.currentTarget.offsetLeft * 2, pos = e.touches[0].pageX, _data = this.data, _status = _data.status, _obj = _status.isVideo ? this._video : this._audio; this.seekVA(parseInt(pos / pLine * _obj.totalTime)); },
/* VideoOrAudio - 跳到某个点开始播放 */
seekVA: function (time) { let _data = this.data, _status = _data.status; _status.isVideo && this._video.seek(time); _status.isAudio && this._audio.seek(time); },
/* setContent页面 - 跳过片头 - bindTap事件 */
......@@ -360,6 +370,9 @@ Page({
let _data = this.data, _status = _data.status, _detail = e.detail, _obj = _status.isVideo ? this._video : this._audio
_obj.currentTime = parseInt(_detail.currentTime)
_obj.totalTime = parseInt(_detail.duration)
if(_status.disable && (_data.ctrlBar.cumulativeDuration > _obj.totalTime - 4) ){
this.setData({ 'ctrlBar.cumulativeDuration': false })
}
this.setData({ 'ctrlBar.progress': _obj.currentTime / _obj.totalTime * 100 + '%' });
this.setData({ 'ctrlBar.currentTime': util.durationToTimeString(_obj.currentTime) });
this.setData({ 'ctrlBar.totalTime': util.durationToTimeString(_obj.totalTime) })
......
......@@ -6,6 +6,10 @@
"postcss": true,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"uglifyFileName": true,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
......@@ -13,8 +17,7 @@
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"nodeModules": false
}
},
"compileType": "miniprogram",
"libVersion": "2.3.0",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论