Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
0f7cc680
提交
0f7cc680
authored
9月 28, 2022
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 视频第一次播放禁用向后拖拽
上级
f0c0a17a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
38 行增加
和
9 行删除
+38
-9
chapterPlayer.vue
src/modules/viewer/components/player/chapterPlayer.vue
+3
-1
videoPlayer.vue
src/modules/viewer/components/player/videoPlayer.vue
+35
-8
没有找到文件。
src/modules/viewer/components/player/chapterPlayer.vue
浏览文件 @
0f7cc680
...
...
@@ -4,9 +4,11 @@
<div
class=
"player-column"
v-show=
"videoVisible"
>
<!-- 视频 -->
<video-player
disabled
:isSkip=
"isSkip"
:skipTime=
"skipTime"
:video=
"chatperResources.video"
:mpt=
"progress.mpt"
@
timeupdate=
"onTimeupdate"
@
ready=
"onReady"
ref=
"videoPlayer"
...
...
@@ -218,7 +220,7 @@ export default {
device_id
:
Cookies
.
get
(
'_idt'
)
})
.
then
(
response
=>
{
this
.
progress
=
response
this
.
progress
=
Object
.
assign
(
response
,
{
mpt
:
window
.
parseInt
(
response
.
mpt
)
})
// 跳转播放进度
if
(
this
.
player
&&
response
.
cpt
)
{
this
.
player
.
seek
(
response
.
cpt
)
...
...
src/modules/viewer/components/player/videoPlayer.vue
浏览文件 @
0f7cc680
...
...
@@ -9,12 +9,22 @@ export default {
isSkip
:
Boolean
,
video
:
Object
,
autoplay
:
{
type
:
Boolean
,
default
:
true
},
disabled
:
{
type
:
Boolean
,
default
:
false
}
disabled
:
{
type
:
Boolean
,
default
:
false
},
mpt
:
{
type
:
Number
,
default
:
0
}
// 最大观看时间点
},
data
()
{
let
videoRetry
=
parseInt
(
window
.
localStorage
.
getItem
(
'videoRetry'
))
videoRetry
=
isNaN
(
videoRetry
)
?
3
:
videoRetry
return
{
player
:
null
,
videoRetry
}
return
{
player
:
null
,
videoRetry
,
currentTime
:
0
,
duration
:
0
}
},
watch
:
{
mpt
:
{
immediate
:
true
,
handler
()
{
const
left
=
(
Math
.
max
(
this
.
mpt
,
this
.
currentTime
)
/
this
.
duration
)
*
100
$
(
'.prism-progress-copy'
).
css
(
'left'
,
left
+
'%'
)
}
}
},
methods
:
{
createPlayer
()
{
...
...
@@ -43,26 +53,34 @@ export default {
useHlsPluginForSafari
:
true
,
language
:
this
.
$i18n
.
locale
===
'zh-CN'
?
'zh-cn'
:
'en-us'
},
function
(
player
)
{
function
(
player
)
{
// 禁止调整进度,隐藏声音和倍数
if
(
_this
.
disabled
)
{
$
(
'.prism-volume, .prism-setting-speed'
).
hide
()
$
(
'.prism-progress'
).
css
(
'pointer-events'
,
'none'
)
// $('.prism-volume, .prism-setting-speed').hide()
// $('.prism-progress').css('pointer-events', 'none')
$
(
'.prism-controlbar'
).
append
(
'<div class="prism-progress-copy"></div>'
)
$
(
'.prism-progress-copy'
).
on
(
'click'
,
e
=>
{
return
false
})
}
player
.
on
(
'playing'
,
function
()
{
_this
.
duration
=
player
.
getDuration
()
})
player
.
on
(
'ready'
,
function
()
{
player
.
on
(
'ready'
,
function
()
{
// 跳过片头
_this
.
isSkip
&&
player
.
seek
(
6
)
_this
.
$emit
(
'ready'
,
player
)
})
player
.
on
(
'timeupdate'
,
function
(
event
)
{
player
.
on
(
'timeupdate'
,
function
(
event
)
{
const
currentTime
=
player
.
getCurrentTime
()
_this
.
currentTime
=
currentTime
_this
.
$emit
(
'timeupdate'
,
currentTime
)
if
(
currentTime
>
1
)
{
window
.
localStorage
.
setItem
(
'videoRetry'
,
3
)
}
})
player
.
on
(
'error'
,
function
(
event
)
{
player
.
on
(
'error'
,
function
(
event
)
{
_this
.
$emit
(
'error'
,
event
)
if
(
_this
.
videoRetry
)
{
window
.
localStorage
.
setItem
(
'videoRetry'
,
_this
.
videoRetry
-
1
)
...
...
@@ -88,4 +106,13 @@ export default {
width
:
100%
;
height
:
100%
;
}
::v-deep
.prism-progress-copy
{
position
:
absolute
;
height
:
18px
;
top
:
-5px
;
left
:
0
;
right
:
0
;
z-index
:
10
;
// pointer-events: none;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论