Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
e85f9572
提交
e85f9572
authored
11月 14, 2024
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update
上级
45d782e2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
61 行增加
和
23 行删除
+61
-23
Live.vue
src/modules/live/test/components/Live.vue
+2
-2
LiveCover.vue
src/modules/live/test/components/LiveCover.vue
+6
-1
LivePlayback.vue
src/modules/live/test/components/LivePlayback.vue
+51
-18
useLiveChat.ts
src/modules/live/test/composables/useLiveChat.ts
+2
-2
没有找到文件。
src/modules/live/test/components/Live.vue
浏览文件 @
e85f9572
...
...
@@ -76,7 +76,7 @@ const {
},
onStop
:
(
blob
)
=>
{
props
.
onStop
&&
props
.
onStop
(
blob
)
handleUpdateRecord
()
handleUpdateRecord
(
{
live_video_size
:
blob
.
size
.
toString
()
}
)
// 保存录像到本地
if
(
props
.
isLocalUpload
)
saveAs
(
blob
,
`
${
fileName
.
value
}
.mp4`
)
},
...
...
@@ -117,7 +117,7 @@ const handleUpload = () => {
dialog
.
open
({
accept
:
'video/mp4'
})
dialog
.
onChange
(
async
([
file
])
=>
{
const
res
=
await
upload
(
file
)
handleUpdateRecord
({
id
:
recordId
.
value
,
live_video_addres
:
res
})
handleUpdateRecord
({
id
:
recordId
.
value
,
live_video_addres
:
res
,
live_video_size
:
file
.
size
.
toString
()
})
ElMessage
.
success
(
'上传成功'
)
})
}
...
...
src/modules/live/test/components/LiveCover.vue
浏览文件 @
e85f9572
...
...
@@ -10,7 +10,12 @@ function scrollToBottom() {
if
(
!
messageRef
.
value
)
return
messageRef
.
value
.
scrollTo
(
0
,
messageRef
.
value
.
scrollHeight
)
}
watch
(
props
.
messages
,
()
=>
nextTick
(()
=>
scrollToBottom
()))
watch
(
()
=>
props
.
messages
,
()
=>
nextTick
(()
=>
scrollToBottom
()),
{
deep
:
true
}
)
const
userName
=
computed
(()
=>
{
const
user
=
detail
.
value
?.
current_user
||
{}
...
...
src/modules/live/test/components/LivePlayback.vue
浏览文件 @
e85f9572
...
...
@@ -16,8 +16,11 @@ const userName = computed(() => {
const
video
=
ref
(
null
)
const
playing
=
ref
(
false
)
const
duration
=
ref
(
0
)
onMounted
(()
=>
{
video
.
value
.
onloadedmetadata
=
(
e
)
=>
{
duration
.
value
=
e
.
target
.
duration
}
video
.
value
.
ontimeupdate
=
()
=>
{
currentTime
.
value
=
Math
.
floor
(
video
.
value
?.
currentTime
)
||
0
}
...
...
@@ -35,6 +38,15 @@ onMounted(() => {
const
togglePlay
=
()
=>
{
playing
.
value
?
video
.
value
?.
pause
()
:
video
.
value
?.
play
()
}
const
handleInput
=
()
=>
{
video
.
value
.
pause
()
}
const
handleChange
=
(
value
)
=>
{
video
.
value
.
currentTime
=
value
video
.
value
.
play
()
}
const
hover
=
ref
(
false
)
</
script
>
<
template
>
...
...
@@ -44,8 +56,13 @@ const togglePlay = () => {
</div>
<div
class=
"live-bd"
>
<video
:src=
"record.live_video_addres"
ref=
"video"
></video>
<LiveCover
:messages=
"messages"
:stats=
"stats"
:viewers=
"viewers"
>
<div
class=
"play-button"
@
click=
"togglePlay"
>
<LiveCover
:messages=
"messages"
:stats=
"stats"
:viewers=
"viewers"
@
mouseover=
"hover = true"
@
mouseleave=
"hover = false"
>
<div
class=
"live-play-button"
@
click=
"togglePlay"
v-show=
"hover || !playing"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"32"
...
...
@@ -77,6 +94,15 @@ const togglePlay = () => {
</defs>
</svg>
</div>
<div
class=
"live-slider"
v-show=
"hover"
>
<el-slider
v-model=
"currentTime"
:max=
"duration"
size=
"small"
:show-tooltip=
"false"
@
change=
"handleChange"
@
input=
"handleInput"
/>
</div>
</LiveCover>
</div>
</div>
...
...
@@ -113,20 +139,27 @@ const togglePlay = () => {
margin-top
:
10px
;
text-align
:
center
;
}
.play-button
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
background-color
:
#000000
33
;
border-radius
:
1000px
;
cursor
:
pointer
;
height
:
64px
;
width
:
64px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
.live-play-button
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
background-color
:
#000000
33
;
border-radius
:
1000px
;
cursor
:
pointer
;
height
:
64px
;
width
:
64px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
z-index
:
100000
;
}
.live-slider
{
position
:
absolute
;
bottom
:
5px
;
left
:
10px
;
right
:
10px
;
z-index
:
100000
;
}
</
style
>
src/modules/live/test/composables/useLiveChat.ts
浏览文件 @
e85f9572
...
...
@@ -152,9 +152,9 @@ export function useLiveChat(options: UseLiveChatOptions = {}) {
currentTime
,
()
=>
{
if
(
defaultMessages
&&
defaultMessages
.
length
>
0
)
{
//
reset()
reset
()
defaultMessages
.
forEach
((
message
)
=>
{
if
(
message
.
currentTime
=
=
currentTime
.
value
)
addMessage
(
message
)
if
(
message
.
currentTime
<
=
currentTime
.
value
)
addMessage
(
message
)
})
}
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论