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

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

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