提交 b9c8bf9f authored 作者: zyx's avatar zyx

设置video001 和 添加 接口 /v2/education/end-aliyun-video-streaming

上级 6b66fadc
......@@ -99,6 +99,14 @@ const getCurrentChapterDetail = (vid, videoType,callback) => {
vid: vid
},
callback: function (res) {
// 进入视频,开始读取视频时,存储 vid、log_key
wx.setStorageSync({
key: 'video_001',
data: {
vid: vid,
log_key: res.data.log_key || ''
}
})
let json = {
video: {
src: videoType == 3 ? res.data.video &&res.data.video.SD : res.data.video[0] && res.data.video[0].playurl,
......@@ -119,6 +127,19 @@ const getCurrentChapterDetail = (vid, videoType,callback) => {
}
})
}
/* 结束时,调用接口 */
const endVideo = () => {
let json = wx.getStorageSync('video_001') || { vid: '', log_key: '' }
if (vid !== '') {
util.requestApi({
url: util.config.URL_PATH1 + '/v2/education/end-aliyun-video-streaming',
data: json,
callback: function (res) {}
})
}
}
/* 获取进度信息 */
// 测试 用 device_id : jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8
const getProgress = (vid, did, sid, callback) => {
......@@ -136,9 +157,11 @@ const getProgress = (vid, did, sid, callback) => {
const updateProgress = (obj) => {
let uid = wx.getStorageSync('uid');
let sid = wx.getStorageSync('sid');
let json = wx.getStorageSync('video_001') || { vid: '', log_key: '' };
util.requestApi({
url: util.config.URL_PATH1 + '/v2/analytics/upload-video',
data: {
log_key: json.log_key,
uid: uid || '',
sid: sid || '',
d: obj.did,
......@@ -157,6 +180,7 @@ const updateProgress = (obj) => {
module.exports = {
getChapterList: getChapterList,
getCurrentChapterDetail: getCurrentChapterDetail,
endVideo: endVideo,
getProgress: getProgress,
updateProgress: updateProgress
}
\ No newline at end of file
......@@ -174,6 +174,7 @@ Page({
})
// CC视频走这个接口
ChapterApi.getCurrentChapterDetail(vid, videoType, (json) => {
ChapterApi.endVideo()
// 播放的视频数据
this.setData({ video: json.video })
this.setData({ audio: json.audio })
......@@ -208,9 +209,11 @@ Page({
this.isBackend = true
this.pauseVA()
clearInterval(this.heartbeat)
ChapterApi.endVideo()
},
onUnload: function () {
this.pauseVA()
ChapterApi.endVideo()
},
onShow: function () {
/* 兼容 android 这里发现 android 打开预览大图,然后关闭 自动播放视频,而且关不掉, 兼容android强制关闭视频 */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论