Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
uniapp_vedio
Commits
f44c16c0
Commit
f44c16c0
authored
Jun 05, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
e8b53bdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
26 deletions
+44
-26
index.vue
vedio/components/home/index.vue
+1
-1
recommendVideo.vue
vedio/components/home/recommendVideo.vue
+40
-14
home.vue
vedio/pages/home.vue
+3
-11
No files found.
vedio/components/home/index.vue
View file @
f44c16c0
...
...
@@ -534,7 +534,7 @@
height
:
100rpx
;
width
:
120rpx
;
right
:
20rpx
;
bottom
:
16
0rpx
;
bottom
:
20
0rpx
;
position
:
absolute
;
z-index
:
999
;
...
...
vedio/components/home/recommendVideo.vue
View file @
f44c16c0
...
...
@@ -3,12 +3,23 @@
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
duration=
"300"
>
<swiper-item
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
>
<view
v-if=
"Math.abs(displayIndex-index)==0"
style=
"height: 100%;"
>
<video
v-if=
"Math.abs(displayIndex-index)==0"
:id=
"''+list.vedioId"
:controls=
"controls"
<view
v-if=
"Math.abs(displayIndex-index)==0"
style=
"height: 100%;background-color: aqua;"
@
click=
"tapVideoHover()"
>
<!--
<video
v-if=
"Math.abs(displayIndex-index)==0"
:id=
"''+list.vedioId"
:controls=
"controls"
:autoplay=
"true"
:isplay=
"true"
play-btn-position=
"center"
:loop=
"!isplay"
@
ended=
"ended"
@
controlstoggle=
"controlstoggle"
:show-fullscreen-btn=
"false"
:poster=
"list.coverImage"
:show-loading=
"true"
@
click=
"tapVideoHover()"
:enable-progress-gesture=
"false"
class=
"tsvideo"
:src=
"list.recommendUrl"
object-fit=
"cover"
/>
:src=
"list.recommendUrl"
object-fit=
"cover"
/>
-->
<tt-video-player
v-if=
"Math.abs(displayIndex-index)==0"
:id=
"list.vedioId"
class=
"tsvideo"
:album-id=
"list.douyinAlbumId"
:cover-id=
"list.douyinCoverId"
:episode-id=
"list.douyinEpisodeId"
:cloud-type=
"1"
version=
"1"
object-fit=
"cover"
:controls=
"controls"
:poster=
"data.coverImage"
:loop=
"!isplay"
:autoplay=
"true"
:enable-progress-gesture=
"false"
:show-loading=
"true"
@
play=
"startPlay"
:show-fullscreen-btn=
"false"
@
controlstoggle=
"controlstoggle"
@
timeupdate=
"timeUpdate"
@
ended=
"ended"
>
<view>
{{
index
+
'-------'
+
displayIndex
}}
</view>
</tt-video-player>
</view>
<view
v-if=
"!isqp"
class=
"userInfo flex"
>
<!-- 点赞 -->
...
...
@@ -50,7 +61,9 @@
</
template
>
<
script
>
import
common
from
'@/mixins/common'
;
import
common
from
'@/mixins/common'
;
import
ttVideoPlayer
from
'@/ttcomponents/tt-video-player/index.js'
import
{
navigateTo
,
...
...
@@ -60,7 +73,10 @@
export
default
{
name
:
"recommendVideo"
,
mixins
:
[
common
],
mixins
:
[
common
],
components
:{
ttVideoPlayer
},
data
()
{
return
{
controls
:
false
,
// 控制按钮
...
...
@@ -130,12 +146,11 @@
this
.
isFirstLoad
=
false
this
.
queryList
()
}
else
{
t
his
.
videoContext
?.
play
()
t
t
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioId
,
this
).
play
();
}
},
stop
()
{
// audo.pause()
this
.
videoContext
?.
pause
()
tt
.
createVideoContext
(
''
+
this
.
originList
[
this
.
originIndex
].
vedioId
,
this
).
pause
();
},
queryList
()
{
// 推荐
...
...
@@ -194,16 +209,26 @@
if
(
this
.
oid
<
0
)
{
this
.
oid
=
this
.
originList
.
length
-
1
}
// console.log('++++++++++++上一条播放数据 Index:', this.oid)
// // audo.pause()
// this.videoContext = uni.createVideoContext("" + this.originList[this.oid].vedioId, this)
// this.videoContext.pause()
// this.videoContext.stop()
console
.
log
(
'++++++++++++上一条播放数据 Index:'
,
this
.
oid
)
// audo.pause()
this
.
videoContext
=
uni
.
createVideoContext
(
""
+
this
.
originList
[
this
.
oid
].
vedioId
,
this
)
this
.
videoContext
.
pause
()
this
.
videoContext
.
stop
()
tt
.
createVideoContext
(
''
+
this
.
originList
[
this
.
oid
].
vedioId
,
this
).
pause
();
setTimeout
(()
=>
{
console
.
log
(
'qqqqqq:'
,
this
.
originList
[
originIndex
].
vedioId
)
t
his
.
videoContext
=
uni
.
createVideoContext
(
""
+
this
.
originList
[
originIndex
].
vedioId
,
this
)
this
.
videoContext
.
play
()
t
t
.
createVideoContext
(
''
+
this
.
originList
[
originIndex
].
vedioId
,
this
).
play
();
// this.commitVideo
()
},
500
)
// setTimeout(() => {
// console.log('qqqqqq:', this.originList[originIndex].vedioId)
// this.videoContext = uni.createVideoContext("" + this.originList[originIndex].vedioId, this)
// this.videoContext.play()
// }, 500)
var
pCount
=
this
.
originList
.
length
-
this
.
playCount
if
(
originIndex
==
pCount
)
{
this
.
queryList
()
...
...
@@ -405,6 +430,7 @@
}
.tsvideo
{
background-color
:
salmon
;
width
:
100%
;
height
:
100%
;
animation
:
showDivAni
1s
1
;
...
...
vedio/pages/home.vue
View file @
f44c16c0
...
...
@@ -125,15 +125,8 @@
this
.
currentPage
=
index
}
// #ifdef MP-TOUTIAO
tt
.
setNavigationBarColor
({
frontColor
:
'#000000'
,
backgroundColor
:
'#ffffff'
})
// #endif
if
(
wx
.
setVisualEffectOnCapture
)
{
wx
.
setVisualEffectOnCapture
({
if
(
tt
.
setVisualEffectOnCapture
)
{
tt
.
setVisualEffectOnCapture
({
visualEffect
:
'hidden'
,
success
:
(
res
)
=>
{
...
...
@@ -147,9 +140,8 @@
// 在子组件重写show()代替onShow()
if
(
this
.
currentPage
==
0
)
{
this
.
$refs
.
index
.
show
();
}
else
if
(
this
.
currentPage
==
1
)
{
//
this.$refs.recommend.show();
this
.
$refs
.
recommend
.
show
();
}
else
if
(
this
.
currentPage
==
2
)
{
this
.
$refs
.
follow
.
show
();
}
else
if
(
this
.
currentPage
==
3
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment