Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
7867dd00
提交
7867dd00
authored
6月 11, 2020
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复学习系统视频播放倍数改变后视频观看时长统计错误的问题
上级
30591c67
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
39 行增加
和
8 行删除
+39
-8
chapterPlayer.vue
...nt/src/modules/viewer/components/player/chapterPlayer.vue
+39
-8
没有找到文件。
client/src/modules/viewer/components/player/chapterPlayer.vue
浏览文件 @
7867dd00
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
<!-- 视频 -->
<!-- 视频 -->
<video-player
<video-player
:isSkip=
"isSkip"
:isSkip=
"isSkip"
:skipTime=
"skipTime"
:video=
"chatperResources.video"
:video=
"chatperResources.video"
@
timeupdate=
"onTimeupdate"
@
timeupdate=
"onTimeupdate"
@
ready=
"onReady"
@
ready=
"onReady"
...
@@ -26,7 +27,12 @@
...
@@ -26,7 +27,12 @@
<em
class=
"player-button player-button-download"
v-if=
"chapter.pdf"
>
<em
class=
"player-button player-button-download"
v-if=
"chapter.pdf"
>
<a
:href=
"chapter.pdf"
download
target=
"_blank"
>
下载PPT
</a>
<a
:href=
"chapter.pdf"
download
target=
"_blank"
>
下载PPT
</a>
</em>
</em>
<em
:class=
"pptClass"
@
click=
"togglePPTVisible"
v-if=
"chatperResources.ppts.length"
>
同步显示PPT
</em>
<em
:class=
"pptClass"
@
click=
"togglePPTVisible"
v-if=
"chatperResources.ppts.length"
>
同步显示PPT
</em
>
<em
:class=
"skipClass"
@
click=
"toggleSkip"
>
始终跳过片头
</em>
<em
:class=
"skipClass"
@
click=
"toggleSkip"
>
始终跳过片头
</em>
</div>
</div>
</div>
</div>
...
@@ -57,9 +63,10 @@ export default {
...
@@ -57,9 +63,10 @@ export default {
videoVisible
:
true
,
videoVisible
:
true
,
pptVisible
:
false
,
pptVisible
:
false
,
isSkip
,
isSkip
,
skipTime
:
6
,
chatperResources
:
null
,
chatperResources
:
null
,
throttled
:
null
,
throttled
:
null
,
throttleWait
:
10
,
// 秒
throttleWait
:
5
,
// 秒
progress
:
{
progress
:
{
cpt
:
0
,
// 当前播放时间
cpt
:
0
,
// 当前播放时间
mpt
:
0
,
// 视频时长
mpt
:
0
,
// 视频时长
...
@@ -67,7 +74,8 @@ export default {
...
@@ -67,7 +74,8 @@ export default {
pt
:
0
// 累计播放时间
pt
:
0
// 累计播放时间
},
},
player
:
null
,
player
:
null
,
watchedTimePoint
:
[]
// 视频观看的时间点
watchedTimePoint
:
[],
// 视频观看的时间点
timer
:
null
}
}
},
},
watch
:
{
watch
:
{
...
@@ -142,12 +150,14 @@ export default {
...
@@ -142,12 +150,14 @@ export default {
if
(
this
.
progress
.
cpt
)
{
if
(
this
.
progress
.
cpt
)
{
this
.
player
.
seek
(
this
.
progress
.
cpt
)
this
.
player
.
seek
(
this
.
progress
.
cpt
)
}
}
// 更新视频观看总时长
this
.
updateWatchTime
()
},
},
// 当前播放时间更新
// 当前播放时间更新
onTimeupdate
(
time
)
{
onTimeupdate
(
time
)
{
const
ppts
=
this
.
chatperResources
.
ppts
||
[]
const
ppts
=
this
.
chatperResources
.
ppts
||
[]
let
index
=
this
.
chatperResources
.
ppts
.
findIndex
(
let
index
=
this
.
chatperResources
.
ppts
.
findIndex
(
item
=>
item
.
ppt_point
>
time
(
item
)
=>
item
.
ppt_point
>
time
)
)
index
=
index
!==
-
1
?
index
-
1
:
ppts
.
length
-
1
index
=
index
!==
-
1
?
index
-
1
:
ppts
.
length
-
1
this
.
$emit
(
'change-ppt'
,
index
)
this
.
$emit
(
'change-ppt'
,
index
)
...
@@ -179,12 +189,12 @@ export default {
...
@@ -179,12 +189,12 @@ export default {
getChapterVideo
()
{
getChapterVideo
()
{
// 视频播放类型 1是CC加密; 2是非加密; 3是阿里云
// 视频播放类型 1是CC加密; 2是非加密; 3是阿里云
if
(
this
.
videoProvider
===
3
)
{
if
(
this
.
videoProvider
===
3
)
{
api
.
getChapterVideoAliyun
(
this
.
resourceId
).
then
(
response
=>
{
api
.
getChapterVideoAliyun
(
this
.
resourceId
).
then
(
(
response
)
=>
{
this
.
chatperResources
=
response
this
.
chatperResources
=
response
Array
.
isArray
(
response
.
ppts
)
&&
this
.
$emit
(
'pptupdate'
,
response
.
ppts
)
Array
.
isArray
(
response
.
ppts
)
&&
this
.
$emit
(
'pptupdate'
,
response
.
ppts
)
})
})
}
else
{
}
else
{
api
.
getChapterVideo
(
this
.
resourceId
).
then
(
response
=>
{
api
.
getChapterVideo
(
this
.
resourceId
).
then
(
(
response
)
=>
{
let
{
video
,
audio
,
ppts
}
=
response
let
{
video
,
audio
,
ppts
}
=
response
video
=
video
.
reduce
(
video
=
video
.
reduce
(
(
result
,
item
)
=>
{
(
result
,
item
)
=>
{
...
@@ -209,7 +219,7 @@ export default {
...
@@ -209,7 +219,7 @@ export default {
.
getChapterVideoProgress
(
this
.
sid
,
this
.
resourceId
,
{
.
getChapterVideoProgress
(
this
.
sid
,
this
.
resourceId
,
{
device_id
:
Cookies
.
get
(
'_idt'
)
device_id
:
Cookies
.
get
(
'_idt'
)
})
})
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
progress
=
response
this
.
progress
=
response
// 跳转播放进度
// 跳转播放进度
if
(
this
.
player
&&
response
.
cpt
)
{
if
(
this
.
player
&&
response
.
cpt
)
{
...
@@ -219,7 +229,7 @@ export default {
...
@@ -219,7 +229,7 @@ export default {
},
},
// 更新章节视频进度
// 更新章节视频进度
updateChapterVideoProgress
(
time
,
durations
)
{
updateChapterVideoProgress
(
time
,
durations
)
{
this
.
progress
.
pt
+=
this
.
throttleWait
//
this.progress.pt += this.throttleWait
// 登录用户信息
// 登录用户信息
const
user
=
window
.
G
.
UserInfo
const
user
=
window
.
G
.
UserInfo
const
params
=
{
const
params
=
{
...
@@ -238,6 +248,24 @@ export default {
...
@@ -238,6 +248,24 @@ export default {
api
.
updateChapterVideoProgress
(
params
)
api
.
updateChapterVideoProgress
(
params
)
// 清空已经上传过的观看时间点
// 清空已经上传过的观看时间点
this
.
watchedTimePoint
=
[]
this
.
watchedTimePoint
=
[]
},
// 更新观看总时长
updateWatchTime
()
{
this
.
timer
&&
clearInterval
(
this
.
timer
)
// 增加跳过片头时间
if
(
this
.
isSkip
&&
!
this
.
progress
.
pt
)
{
this
.
progress
.
pt
=
this
.
skipTime
+
this
.
throttleWait
}
// 默认增加时间
this
.
progress
.
pt
=
this
.
progress
.
pt
||
this
.
throttleWait
this
.
timer
=
setInterval
(()
=>
{
const
status
=
this
.
player
.
getStatus
()
if
(
status
===
'playing'
)
{
// 播放倍速
const
speed
=
this
.
player
.
_originalPlaybackRate
||
1
this
.
progress
.
pt
=
this
.
progress
.
pt
+
1
*
speed
}
},
1000
)
}
}
},
},
beforeMount
()
{
beforeMount
()
{
...
@@ -245,6 +273,9 @@ export default {
...
@@ -245,6 +273,9 @@ export default {
this
.
getChapterVideo
()
this
.
getChapterVideo
()
// 获取视频进度
// 获取视频进度
this
.
getChapterVideoProgress
()
this
.
getChapterVideoProgress
()
},
destroyed
()
{
this
.
timer
&&
clearInterval
(
this
.
timer
)
}
}
}
}
</
script
>
</
script
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论