Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-activity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7e588fa1
authored
Oct 08, 2022
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
直播样式和逻辑
1 parent
0cd7685d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
104 deletions
src/components/LiveBox.vue
src/components/LiveBox.vue
View file @
7e588fa
<
template
>
<
template
>
<!-- v-if="LiveProps[liveDetail.status].isLive" -->
<!-- v-if="LiveProps[liveDetail.status].isLive" -->
<div
class=
"videoContainer"
>
<div
class=
"videoContainer"
>
<div
class=
"small-box"
<div
class=
"small-box"
@
click=
"isSmallBox = false"
v-show=
"isSmallBox"
>
@
click=
"isSmallBox = false"
<img
class=
"icon-small-live"
src=
"@/assets/images/icon-small-live.png"
/>
v-show=
"isSmallBox"
>
<img
class=
"icon-small-live"
src=
"@/assets/images/icon-small-live.png"
/>
<div
class=
"flex small-content"
>
<div
class=
"flex small-content"
>
<!--
<div
v-if=
"LiveStatus[liveDetail.status] == 'live'"
class=
"live-line"
>
-->
<!--
<div
v-if=
"LiveStatus[liveDetail.status] == 'live'"
class=
"live-line"
>
-->
<div
class=
"live-line"
>
<div
class=
"live-line"
v-if=
"LiveProps[liveDetail.status].isLive"
>
<div
class=
"side"
></div>
<div
class=
"side"
></div>
<div
class=
"center side"
></div>
<div
class=
"center side"
></div>
<div
class=
"side"
></div>
<div
class=
"side"
></div>
</div>
</div>
<!--
<div
class=
"text"
>
{{
LiveStatus
[
liveDetail
.
status
]
==
'live'
?
'直播'
:
'回放'
}}
</div>
-->
<img
v-if=
"!LiveProps[liveDetail.status].isLive"
:src=
"IMAGES.REPLAY_ICON"
class=
"live-replayIcon"
/>
<!--
<div
class=
"text"
>
{{
LiveProps
[
liveDetail
.
status
].
status
}}
</div>
-->
<div
class=
"text"
>
{{
LiveProps
[
liveDetail
.
status
].
status
}}
</div>
<div
class=
"text"
>
{{
LiveProps
[
liveDetail
.
status
].
status
}}
</div>
</div>
</div>
</div>
</div>
<!-- @click="openFullscreen" -->
<!-- @click="openFullscreen" -->
<!-- @touchmove.stop.prevent 禁止使用滚动 -->
<!-- @touchmove.stop.prevent 禁止使用滚动 -->
<div
:style=
"videoStyle"
<div
:style=
"videoStyle"
@
touchmove
.
stop
.
prevent
id=
"live-box"
:class=
"['live-box',
{ videoFullscreen: videoFullscreen }]" v-show="!isSmallBox">
@
touchmove
.
stop
.
prevent
<div
class=
"sprite-icon icon-live-close"
v-show=
"!videoFullscreen && !isSmallBox"
@
click=
"isSmallBox = true"
></div>
id=
"live-box"
:class=
"['live-box',
{ videoFullscreen: videoFullscreen }]"
v-show="!isSmallBox">
<div
class=
"sprite-icon icon-live-close"
v-show=
"!videoFullscreen && !isSmallBox"
@
click=
"isSmallBox = true"
></div>
<div
:class=
"
{ videoShort: isAction }">
<div
:class=
"
{ videoShort: isAction }">
<div
class=
"mask"
>
<div
class=
"mask"
>
<div
class=
"status flex"
>
<div
class=
"status flex"
>
<!--
<div
v-if=
"LiveStatus[liveDetail.status] == 'live'"
class=
"live-line"
>
-->
<div
v-if=
"LiveProps[liveDetail.status].isLive"
class=
"live-line"
>
<div
v-if=
"LiveProps[liveDetail.status].isLive"
class=
"live-line"
>
<div
class=
"side"
></div>
<div
class=
"side"
></div>
<div
class=
"center side"
></div>
<div
class=
"center side"
></div>
<div
class=
"side"
></div>
<div
class=
"side"
></div>
</div>
</div>
<!-- 回放图标 -->
<!-- 回放图标 -->
<!-- :src="" -->
<img
v-if=
"!LiveProps[liveDetail.status].isLive"
:src=
"IMAGES.REPLAY_ICON"
class=
"live-replayIcon"
/>
<img
v-if=
"!LiveProps[liveDetail.status].isLive"
:src=
"IMAGES.REPLAY_ICON"
class=
"live-replayIcon"
/>
<!--
<div
class=
"text"
>
{{
LiveStatus
[
liveDetail
.
status
]
==
'live'
?
'正在直播'
:
'直播回放'
}}
</div>
-->
<div
class=
"text"
>
{{
LiveProps
[
liveDetail
.
status
].
text
}}
</div>
<div
class=
"text"
>
{{
LiveProps
[
liveDetail
.
status
].
text
}}
</div>
</div>
</div>
<template
v-if=
"isShowGif"
>
<template
v-if=
"isShowGif"
>
<!-- v-if="LiveProps[liveDetail.status].covergif" -->
<img
class=
"coverGif"
:src=
"LiveProps[liveDetail.status].covergif"
alt=
""
/>
<!--
<img
v-if=
"LiveStatus[liveDetail.status] == 'live'"
src=
"https://wimg.588ku.com/gif620/20/04/23/79a7882dfb0c59497976fd8b3bfe60ef.gif"
alt=
""
/>
-->
<img
class=
"coverGif"
:src=
"LiveProps[liveDetail.status].covergif"
alt=
""
/>
<!--
<img
v-else
:src=
"IMAGES.COVER_REPLAY"
alt=
""
/>
-->
</
template
>
</
template
>
</div>
</div>
<div
class=
"fullscreen-btn"
<div
class=
"fullscreen-btn"
@
click=
"openFullscreen(false)"
>
@
click=
"openFullscreen(false)"
>
<img
:src=
"IMAGES.FULL_SCREEN"
/>
<img
:src=
"IMAGES.FULL_SCREEN"
/>
</div>
</div>
<div
class=
"poster-btn"
<div
class=
"poster-btn"
@
click=
"showKf = true"
>
@
click=
"showKf = true"
>
<img
:src=
"detail.floatingMaskDiagram"
/>
<img
:src=
"detail.floatingMaskDiagram"
/>
</div>
</div>
<video
id=
"player-container-id"
<video
id=
"player-container-id"
preload=
"auto"
playsinline
webkit-playsinline
></video>
preload=
"auto"
<group-modal
v-model=
"showKf"
:detail=
"detail"
/>
playsinline
webkit-playsinline
></video>
<group-modal
v-model=
"showKf"
:detail=
"detail"
/>
</div>
</div>
<action
:bgBlack=
"true"
<action
:bgBlack=
"true"
class=
"BgAction"
v-show=
"videoFullscreen && isAction"
></action>
class=
"BgAction"
v-show=
"videoFullscreen && isAction"
></action>
</div>
</div>
</div>
</div>
</template>
</template>
...
@@ -116,8 +84,6 @@ export default {
...
@@ -116,8 +84,6 @@ export default {
showKf
:
false
,
showKf
:
false
,
isShowGif
:
false
,
isShowGif
:
false
,
videoStyle
:
''
,
videoStyle
:
''
,
// LiveStatus: CONSTANTS.LiveStatus,
// LiveProps: CONSTANTS.LiveProps,
isSmallBox
:
false
,
//是否显示小容器直播
isSmallBox
:
false
,
//是否显示小容器直播
LiveProps
,
LiveProps
,
IMAGES
IMAGES
...
@@ -150,54 +116,10 @@ export default {
...
@@ -150,54 +116,10 @@ export default {
},
},
mounted
()
{
mounted
()
{
console
.
log
(
this
.
liveDetail
,
'============'
)
this
.
createPlayerCover
()
this
.
createPlayerCover
()
this
.
createPlayer
()
this
.
createPlayer
()
this
.
play
()
this
.
play
()
console
.
log
(
'2222222222'
,
this
.
liveDetail
);
// console.log('2222222222', this.liveDetail)
// const _this = this
// if (!this.IsIOS) {
// this.changeGifStatus()
// }
// wxConfig.ready(() => {
// if (Hls.isSupported()) {
// _this.video = document.getElementById('player-container-id')
// _this.hls = new Hls()
// // bind them together
// _this.hls.attachMedia(_this.video)
// }
// const playParams = {
// autoplay: true, // 自动播放
// loop: true, // 循环播放
// // muted: false, // 是否静音
// controlBar: { // 控制条配置
// fullscreenToggle: false // 隐藏全屏按钮
// },
// webrtcConfig: { // webrtcConfig 参数列表
// showLog: true // 打印webrtc日志
// }
// }
// _this.player = TCPlayer('player-container-id', playParams)
// wx.getNetworkType({
// success: (result) => {
// _this.player.ready(function() { // 设置播放器初始化完成后的回调
// const src = _this.LiveStatus[_this.liveDetail.status] == 'live' ? _this.liveDetail.playPath : (_this.liveDetail.liveBroadcastRecordingFileList.length ? _this.liveDetail.liveBroadcastRecordingFileList[0].videoUrl : '')
// _this.player.src(src)
// _this.player.poster()
// _this.player.play() // 播放视频
// _this.draggable(document.getElementById('live-box'), _this.openFullscreen)
// })
// }
// })
// _this.player.on('play', () => {
// this.changeGifStatus()
// })
// _this.player.on('pause', () => {
// this.changeGifStatus()
// })
// _this.dealTcPlayerErr14(_this)
// })
},
},
methods
:
{
methods
:
{
createPlayerCover
()
{
createPlayerCover
()
{
...
@@ -210,23 +132,27 @@ export default {
...
@@ -210,23 +132,27 @@ export default {
wxConfig
.
ready
(()
=>
{
wxConfig
.
ready
(()
=>
{
wx
.
getNetworkType
({
wx
.
getNetworkType
({
success
:
(
result
)
=>
{
success
:
(
result
)
=>
{
console
.
log
(
'===='
,
{
result
});
//
console.log('====', { result });
this
.
player
.
ready
(()
=>
{
// 设置播放器初始化完成后的回调
this
.
player
.
ready
(()
=>
{
// 设置播放器初始化完成后的回调
this
.
fixHls
()
this
.
fixHls
()
const
src
=
this
.
LiveProps
[
this
.
liveDetail
.
status
].
isLive
?
this
.
liveDetail
.
playPath
:
(
this
.
liveDetail
.
liveBroadcastRecordingFileList
||
[])[
0
]?.
videoUrl
const
src
=
this
.
LiveProps
[
this
.
liveDetail
.
status
].
isLive
?
this
.
liveDetail
.
playPath
:
(
this
.
liveDetail
.
liveBroadcastRecordingFileList
||
[])[
0
]?.
videoUrl
this
.
player
.
src
(
src
)
this
.
player
.
src
(
src
)
// this.player.src('http://play.glsx.com.cn/live/live.m3u8')
this
.
player
.
poster
()
this
.
player
.
poster
()
this
.
player
.
play
()
// 播放视频
this
.
player
.
play
()
// 播放视频
// console.log('this.draggable', this.draggable)
this
.
draggable
(
document
.
getElementById
(
'live-box'
),
this
.
openFullscreen
,
'icon-live-close'
)
this
.
draggable
(
document
.
getElementById
(
'live-box'
),
this
.
openFullscreen
,
'icon-live-close'
)
//
})
})
}
}
})
})
})
})
},
},
controlBarStyle
()
{
if
(
this
.
isAction
)
{
var
[
controlBar
]
=
document
.
getElementsByClassName
(
'vjs-control-bar'
)
controlBar
.
style
.
bottom
=
'10vh'
}
},
fixHls
()
{
fixHls
()
{
if
(
Hls
.
isSupported
())
{
if
(
Hls
.
isSupported
())
{
this
.
video
=
document
.
getElementById
(
PLAYERDOMID
)
this
.
video
=
document
.
getElementById
(
PLAYERDOMID
)
...
@@ -238,7 +164,7 @@ export default {
...
@@ -238,7 +164,7 @@ export default {
},
},
// 打开关闭全屏
// 打开关闭全屏
openFullscreen
(
status
=
true
)
{
openFullscreen
(
status
=
true
)
{
console
.
log
(
'openFullscreen'
)
//
console.log('openFullscreen')
this
.
isShowGif
=
false
this
.
isShowGif
=
false
const
[
live
]
=
document
.
getElementsByClassName
(
'live-box'
)
const
[
live
]
=
document
.
getElementsByClassName
(
'live-box'
)
const
[
volumePanel
]
=
document
.
getElementsByClassName
(
'vjs-volume-panel '
)
const
[
volumePanel
]
=
document
.
getElementsByClassName
(
'vjs-volume-panel '
)
...
@@ -247,6 +173,7 @@ export default {
...
@@ -247,6 +173,7 @@ export default {
this
.
player
.
play
()
this
.
player
.
play
()
this
.
videoFullscreen
=
status
this
.
videoFullscreen
=
status
live
.
id
=
status
?
''
:
'live-box'
live
.
id
=
status
?
''
:
'live-box'
this
.
controlBarStyle
()
this
.
$emit
(
'handleLiveFull'
,
{
isFull
:
this
.
videoFullscreen
})
this
.
$emit
(
'handleLiveFull'
,
{
isFull
:
this
.
videoFullscreen
})
},
},
// 处理tcplayer错误码14
// 处理tcplayer错误码14
...
@@ -274,10 +201,6 @@ export default {
...
@@ -274,10 +201,6 @@ export default {
changeGifStatus
()
{
changeGifStatus
()
{
this
.
isShowGif
=
!
this
.
isShowGif
this
.
isShowGif
=
!
this
.
isShowGif
},
},
handleClose
()
{
// e.stopPropagation()
console
.
log
(
'关闭--22222222222222222'
)
},
continueVideo
()
{
continueVideo
()
{
this
.
player
.
play
()
this
.
player
.
play
()
}
}
...
@@ -289,7 +212,7 @@ export default {
...
@@ -289,7 +212,7 @@ export default {
position
:
fixed
;
position
:
fixed
;
top
:
18%
;
top
:
18%
;
right
:
0
;
right
:
0
;
z-index
:
2
;
z-index
:
7
;
//
position
:
relative
;
//
position
:
relative
;
width
:
52px
;
width
:
52px
;
height
:
21px
;
height
:
21px
;
...
@@ -305,6 +228,7 @@ export default {
...
@@ -305,6 +228,7 @@ export default {
//
object-fit
:
cover
;
//
object-fit
:
cover
;
}
}
.small-content
{
.small-content
{
position
:
relative
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
z-index
:
9
;
z-index
:
9
;
...
@@ -314,6 +238,15 @@ export default {
...
@@ -314,6 +238,15 @@ export default {
justify-content
:
center
;
justify-content
:
center
;
//
padding
:
;
//
padding
:
;
text-align
:
right
;
text-align
:
right
;
.live-replayIcon
{
position
:
absolute
;
left
:
7px
;
top
:
5px
;
display
:
inline-block
;
width
:
10px
;
height
:
10px
;
z-index
:
9
;
}
.text
{
.text
{
z-index
:
40
;
z-index
:
40
;
margin-left
:
15px
;
margin-left
:
15px
;
...
@@ -430,7 +363,7 @@ export default {
...
@@ -430,7 +363,7 @@ export default {
/
deep
/
.vjs-control-bar
{
/
deep
/
.vjs-control-bar
{
opacity
:
1
!important
;
opacity
:
1
!important
;
bottom
:
10vh
;
//
bottom
:
10vh
;
background
:
none
!important
;
background
:
none
!important
;
//
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
//
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment