提交 4ef7627c authored 作者: hexi's avatar hexi

增加阿里云视频

......@@ -20,6 +20,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo = {
id: _.children[j-1].resource_id,
time: _.children[j-1].video && util.durationToTimeString(_.children[j-1].video.video_length) || '',
videoType: _.children[j-1].video && _.children[j-1].video.video_provider || '',
name: _.children[j-1].name
}
} else if (i-1>=0) {
......@@ -27,6 +28,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo = {
id: _temp.children[_temp.children.length-1].resource_id,
time: _temp.children[_temp.children.length-1].video && util.durationToTimeString(_temp.children[_temp.children.length-1].video.video_length) || '',
videoType: _.children[_temp.children.length-1].video && _.children[_temp.children.length-1].video.video_provider || '',
name: _temp.children[_temp.children.length-1].name
}
}
......@@ -34,6 +36,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo = {
id: _.children[j + 1].resource_id,
time: _.children[j + 1].video && util.durationToTimeString(_.children[j + 1].video.video_length) || '',
videoType: _.children[j + 1].video && _.children[j + 1].video.video_provider || '',
name: _.children[j + 1].name
}
} else if (i + 1 < res.data.chapters.length) {
......@@ -41,6 +44,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo = {
id: _temp.children[0].resource_id,
time: _temp.children[0].video && util.durationToTimeString(_temp.children[0].video.video_length) || '',
videoType: _.children[0].video && _.children[0].video.video_provider || '',
name: _temp.children[0].name
}
}
......@@ -64,6 +68,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
return {
id: __.resource_id,
time: __.video && util.durationToTimeString(__.video.video_length) || '',
videoType:__.video && __.video.video_provider,
name: __.name,
homework: _homework
}
......@@ -78,9 +83,17 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
})
}
/* 获取对应某个章节的详细信息 */
const getCurrentChapterDetail = (vid, callback) => {
const getCurrentChapterDetail = (vid, videoType,callback) => {
// CC视频请求数据接口
let _url = null;
if(videoType == 3){
_url = util.config.URL_PATH1 + '/v2/education/aliyun-video-streaming'
}else{
_url = util.config.URL_PATH1 + '/v2/education/video-streaming'
}
util.requestApi({
url: util.config.URL_PATH1 + '/v2/education/video-streaming',
url: _url,
method: 'POST',
data: {
vid: vid
......@@ -88,11 +101,11 @@ const getCurrentChapterDetail = (vid, callback) => {
callback: function (res) {
let json = {
video: {
src: res.data.video[0].playurl,
src: videoType == 3 ? res.data.video &&res.data.video.LD : res.data.video[0] && res.data.video[0].playurl,
spareSrc: 'http://pd4t7ae3m.bkt.clouddn.com/test.mp4' // 正式环境时,需要将 contentVideo 中 spareSrc 改成 src
},
audio: {
src: res.data.audio[0].url,
src: videoType == 3 ? res.data.video &&res.data.video.SQ : res.data.audio[0].url,
poster: res.data.ppts && res.data.ppts[0] && res.data.ppts[0].ppt_url || ''
},
image: {
......
......@@ -106,6 +106,7 @@ const getCourseDetail = (id, sid, callback) => {
sid: cur.semester_id,
vid: __.resource_id,
time: __.video && util.durationToTimeString(__.video.video_length) || '',
videoType:__.video && __.video.video_provider,
name: __.name,
homework: _homework
}
......
#### 3.0.8.2019.07.25
1、增加阿里视频源
#### 3.0.8.2019.07.22
1、修复安卓手机数据上报问题
#### 3.0.7.2019.07.17
......
......@@ -223,7 +223,7 @@ Page({
/* 如果未选课,不能查看课程内容 */
if (!this.data.headerInfo.isStart) { wx.showToast({ title: '先选课,才能看', icon: 'none', duration: 1500 }); return ; }
let _data = e.target.dataset
let cid = _data.cid, sid = _data.sid, vid = _data.vid
let cid = _data.cid, sid = _data.sid, vid = _data.vid,video_type = _data.videoType;
if (!_data.hasva) {
/* 如果存在 - 课后习题类型, type:3、work_type:1 */
let i1 = _data.index, i2 = _data.index1
......@@ -238,8 +238,9 @@ Page({
}
wx.showToast({ title: '请在PC上使用该功能', icon: 'none' }); return ;
}
wx.navigateTo({
url: '/pages/videoPlayer/show' + '?cid=' + cid + '&sid=' + sid + '&vid=' + vid
url: '/pages/videoPlayer/show' + '?cid=' + cid + '&sid=' + sid + '&vid=' + vid + '&type=' + video_type
})
},
/**
......
......@@ -8,7 +8,7 @@
</view>
<block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'>
<view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
{{item1.name}}
<view class='time'>{{item1.time}}</view>
</view>
......
......@@ -7,7 +7,7 @@
<view class='title'>{{item.title}}</view>
<block wx:for='{{item.chapters}}' wx:key='{{index1}}' wx:for-item="item1" wx:for-index='index1'>
<view class='body {{item1.id === chapterList.currentChapterId && "on"}}'>
<view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'>
<view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
{{item1.name}}
<view class='time'>{{item1.time}}</view>
</view>
......
......@@ -142,12 +142,14 @@ Page({
}, 200);
},
/* 页面初始入口,会 先走 AJAX 读取 章节列表数据、音视频和PPT数据、进度数据 */
ajaxInitGetInfo: function (vid) {
ajaxInitGetInfo: function (vid,videoType) {
let cid = this.data.options.cid, sid = this.data.options.sid, did = 'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8';
ChapterApi.getChapterList(cid, sid, vid, (json) => {
this.setData({ 'chapterList': json })
})
ChapterApi.getCurrentChapterDetail(vid, (json) => {
// CC视频走这个接口
ChapterApi.getCurrentChapterDetail(vid,videoType, (json) => {
// 播放的视频数据
this.setData({ 'video': json.video })
this.setData({ 'audio': json.audio })
this.setData({ 'image': json.image })
......@@ -191,7 +193,7 @@ Page({
}
},
/* 生命周期函数--监听页面初次渲染完成 */
onReady: function () { this.ajaxInitGetInfo(this.data.options.vid); },
onReady: function () { this.ajaxInitGetInfo(this.data.options.vid,this.data.options.type); },
/* controlBar页面 - 切换音频页面 - bindTap事件 */
showContentAudio: function () {
......@@ -230,7 +232,6 @@ Page({
jumpToOtherVA: function (e) {
/* 跳转时,清空当前播放状态 */
this.heartbeat && clearInterval(this.heartbeat)
let _data = e.target.dataset;
if (!_data.hasva) {
/* 如果存在 - 课后习题类型, type:3、work_type:1 */
......@@ -248,7 +249,7 @@ Page({
}
this.isFirstInitAndSwitchVideo = true;
this.statusClear(_data.name, _data.id);
this.ajaxInitGetInfo(_data.id);
this.ajaxInitGetInfo(_data.id,_data.type);
},
/* controlBar页面 和 selectChapterList页面 - 切换章节列表: 辅助方法 - 1. 暂停视频;2. 关闭章节选择列表;3. 状态清理(status、videoCacheCtrlBar、audioCacheCtrlBar);4. 设置微信导航头 */
statusClear: function (name, id) {
......
......@@ -20,8 +20,13 @@ const url_online = {
outSiteLink: 'https://e-learning.ezijing.com', // 正式外链
tenant: 'collage',
version: '3.0.8'
<<<<<<< HEAD
};
let config = url_online;
=======
}
let config = url_test;
>>>>>>> master
/* 请求接口统一 重定义 */
const requestApi = (obj) => {
let _token = wx.getStorageSync('userSession').sessionKey;
......@@ -161,7 +166,7 @@ const loginApi = (obj, callback) => {
unionid: res.data.union_id
},
success: res2 => {
if (res2.statusCode != 200) { wx.showToast({ title: res.data.message||'获取用户信息失败', icon: 'none' }); return; }
if (res2.statusCode != 200) { wx.showToast({ title: res2.data.message||'获取用户信息失败', icon: 'none' }); return; }
wx.setStorageSync("sid", res2.data.id);
wx.setStorageSync("uid", res1.data.uid);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论