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
858a0319
Commit
858a0319
authored
Jan 24, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
cedac2ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
+38
-6
recommendVideo.vue
vedio/pages/recommend/recommendVideo.vue
+35
-3
ttVideoDetail.vue
vedio/pagesC/ttvideo/ttVideoDetail.vue
+3
-3
No files found.
vedio/pages/recommend/recommendVideo.vue
View file @
858a0319
...
...
@@ -3,12 +3,18 @@
<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%;"
@
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"
:album-id=
"list.douyinAlbumId"
:episode-id=
"list.douyinEpisodeId"
:cloud-type=
"1"
version=
"1"
object-fit=
"contain"
:controls=
"controls"
:poster=
"data.coverImage"
:loop=
"!isplay"
:autoplay=
"true"
:enable-progress-gesture=
"false"
:show-loading=
"true"
@
play=
"startPlay"
:show-fullscreen-btn=
"false"
@
controlstoggle=
"controlstoggle"
@
ended=
"ended"
/>
</view>
<view
v-if=
"!isqp"
class=
"userInfo flex"
>
<!-- 点赞 -->
...
...
@@ -151,6 +157,32 @@
this
.
isqp
=
true
this
.
controls
=
true
},
startPlay
()
{
if
(
tt
.
canIUse
(
'preloadResourceVideo'
))
{
this
.
preloadplaylet
()
}
},
preloadplaylet
()
{
var
preIndex
=
0
if
(
this
.
displayIndex
<
2
)
{
preIndex
=
this
.
displayIndex
+
1
}
else
{
preIndex
=
0
}
// 抖音预加载
tt
.
preloadResourceVideo
({
albumId
:
this
.
displaySwiperList
[
preIndex
].
douyinAlbumId
,
episodeId
:
this
.
displaySwiperList
[
preIndex
].
douyinEpisodeId
,
cloudType
:
1
,
version
:
1
,
success
:
()
=>
{
console
.
log
(
"短剧预加载成功"
+
this
.
displaySwiperList
[
preIndex
].
douyinEpisodeId
);
},
fail
:
(
error
)
=>
{
console
.
log
(
"短剧预加载失败"
,
error
);
},
});
},
ended
()
{
// 1.播放当前视频结束时触发,自动切换下一个视频
if
(
this
.
isplay
)
{
...
...
vedio/pagesC/ttvideo/ttVideoDetail.vue
View file @
858a0319
...
...
@@ -4,18 +4,18 @@
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
:duration=
"duration"
>
<swiper-item
style=
"background-color: black;"
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
@
click=
"tapVides()"
>
<block>
<tt-video-player
v-if=
"
canUseTTPlayer &&
Math.abs(displayIndex-index)==0"
:id=
"list.vedioIndex"
<tt-video-player
v-if=
"Math.abs(displayIndex-index)==0"
:id=
"list.vedioIndex"
:album-id=
"list.douyinAlbumId"
:episode-id=
"list.douyinEpisodeId"
:cloud-type=
"1"
version=
"1"
object-fit=
"contain"
:controls=
"controls"
:poster=
"data.coverImage"
:loop=
"!isplay"
:autoplay=
"!list.lock"
:enable-progress-gesture=
"false"
:show-loading=
"true"
@
play=
"startPlay"
:show-fullscreen-btn=
"false"
@
controlstoggle=
"controlstoggle"
@
timeupdate=
"timeUpdate"
@
ended=
"ended"
/>
<video
v-if=
"!canUseTTPlayer && Math.abs(displayIndex-index)==0"
:id=
"list.vedioIndex"
<
!--
<
video
v-if=
"!canUseTTPlayer && Math.abs(displayIndex-index)==0"
:id=
"list.vedioIndex"
@
ended=
"ended"
:controls=
"controls"
:loop=
"!isplay"
:enable-progress-gesture=
"false"
:show-loading=
"true"
:show-fullscreen-btn=
"false"
@
controlstoggle=
"controlstoggle"
:poster=
"data.coverImage"
@
timeupdate=
"timeupdate"
:autoplay=
"!list.lock"
:src=
"list.vedioUrl"
class=
"tsvideo"
play-btn-position=
"center"
object-fit=
"contain"
/>
class=
"tsvideo"
play-btn-position=
"center"
object-fit=
"contain"
/>
-->
<view
v-if=
"originList[originIndex].lock || !list.vedioUrl"
class=
"videoHover tsimg"
@
click
.
stop=
"tapVideoHover(index,list.pays)"
...
...
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