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
fb0b06a1
Commit
fb0b06a1
authored
Dec 20, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
4439fb98
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
187 deletions
+11
-187
index.vue
vedio/components/home/index.vue
+1
-2
pages.json
vedio/pages.json
+0
-11
test.vue
vedio/pagesC/test/test.vue
+0
-162
ttVideoDetail.vue
vedio/pagesC/ttvideo/ttVideoDetail.vue
+10
-12
No files found.
vedio/components/home/index.vue
View file @
fb0b06a1
...
...
@@ -316,8 +316,7 @@
},
handleInfo
(
item
)
{
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
// navigateTo(`/pagesC/ttvideo/ttVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
navigateTo
(
`/pagesC/test/test`
);
navigateTo
(
`/pagesC/ttvideo/ttVideoDetail?data=`
+
encodeURIComponent
(
JSON
.
stringify
(
item
)));
},
handleTop
(
item
)
{
// navigateTo(`/pagesC/video/newVideoDetail?data=` + encodeURIComponent(JSON.stringify(item)));
...
...
vedio/pages.json
View file @
fb0b06a1
...
...
@@ -94,17 +94,6 @@
}
}
},
{
"path"
:
"test/test"
,
"style"
:
{
"navigationStyle"
:
"default"
,
"navigationBarBackgroundColor"
:
"#000000"
,
"navigationBarTextStyle"
:
"#ffffff"
,
"usingComponents "
:
{
"video-player"
:
"ext://industry/video-player"
}
}
},
{
"path"
:
"video/newVideoDetail"
,
"style"
:
{
...
...
vedio/pagesC/test/test.vue
deleted
100644 → 0
View file @
4439fb98
<
template
>
<view
class=
"content"
>
<view>
<text
class=
"title"
>
{{
title
}}
</text>
</view>
<video-player
id=
"myPlayer"
class=
"player-content"
:album-id=
"aid"
:episode-id=
"eid"
:cloud-type=
"type"
autoplay
show-playback-rate-btn
show-mute-btn
enable-play-in-background
@
play=
"playHandler"
@
pause=
"pauseHandler"
@
error=
"error"
@
ended=
"endedHandler"
@
timeupdate=
"timeUpdateHandler"
@
progress=
"progressHandler"
@
fullscreenchange=
"fullscreenchange"
@
controlstoggle=
"controlstoggle"
@
waiting=
"waitingHandler"
@
loadedmetadata=
"loadedmetadataHandler"
@
seekcomplete=
"seekcomplete"
@
playbackratechange=
"playbackratechange"
@
mutechange=
"mutechange"
@
controltap=
"controltap"
@
enterbackground=
"enterbackground"
@
closebackground=
"closebackground"
@
getsource=
"getsource"
>
</video-player>
<text
@
click=
"testPlay"
>
播放
</text>
</view>
</
template
>
<
script
>
export
default
{
name
:
"test"
,
data
()
{
return
{
title
:
"uniapp - video-player 组件demo"
,
aid
:
"7312718809956090368"
,
eid
:
"7312656326428262953"
,
type
:
1
,
version
:
"1"
,
src
:
""
};
},
onLoad
()
{
console
.
log
(
'tt.canIUse video-player'
,
uni
.
canIUse
(
'video-player'
))
console
.
log
(
'tt.canIUse bindleavebackground'
,
uni
.
canIUse
(
'bindleavebackground'
))
},
methods
:
{
testPlay
()
{
let
videoContext
=
tt
.
createVideoContext
(
'myPlayer'
,
this
)
videoContext
.
play
();
},
// bindplay
playHandler
()
{
console
.
log
(
'bindplay:当开始播放时触发play事件'
)
},
// bindpause
pauseHandler
()
{
console
.
log
(
"bindpause:当暂停播放时触发pause事件"
)
},
// // bindended todo
endedHandler
()
{
console
.
log
(
"bindended:当播放到末尾时触发ended事件"
)
},
// binderror
error
(
e
)
{
console
.
log
(
"binderror:视频播放出错时触发error事件"
,
e
.
detail
)
},
// bindtimeupdate
timeUpdateHandler
(
e
)
{
const
{
currentTime
,
duration
}
=
e
.
detail
;
console
.
log
(
"bindtimeupdate:播放进度变化时触发"
,
"当前播放时间点:"
+
currentTime
,
"视频总时长:"
+
duration
)
},
// bindprogress todo
progressHandler
(
e
)
{
const
{
buffered
}
=
e
.
detail
;
console
.
log
(
"bindprogress:视频缓冲进度更新时触发"
,
"当前视频缓冲了"
+
buffered
+
"%"
)
},
//bindfullscreenchange todo
fullscreenchange
(
e
)
{
const
{
fullScreen
,
direction
}
=
e
.
detail
;
console
.
log
(
"bindfullscreenchange:视频进入和退出全屏时触发"
,
"fullScreen:"
+
fullScreen
,
"全屏时视频的方向:"
+
direction
,
)
},
//bindcontrolstoggle todo
controlstoggle
(
e
)
{
const
{
show
}
=
e
.
detail
;
console
.
log
(
"bindcontrolstoggle:切换播放控件显示/隐藏时触发"
,
"show"
+
show
)
},
//bindwaiting todo
waitingHandler
()
{
console
.
log
(
"bindwaiting:视频出现缓冲时触发"
)
},
//bindloadedmetadata todo
loadedmetadataHandler
(
e
)
{
const
{
width
,
height
,
duration
}
=
e
.
detail
;
console
.
log
(
"bindloadedmetadata:视频元数据加载完成时触发"
,
"width:"
+
width
,
"height:"
+
height
,
"duration:"
+
duration
)
},
// bindseekcomplete todo
seekcomplete
(
e
)
{
const
{
position
}
=
e
.
detail
;
console
.
log
(
"bindseekcomplete:seek 完成时触发"
,
"position:"
+
position
)
},
// bindplaybackratechange todo
playbackratechange
(
e
)
{
const
{
playbackRate
}
=
e
.
detail
;
console
.
log
(
"bindplaybackratechange:视频倍速改变完成时触发"
,
"playbackRate:"
+
playbackRate
)
},
// bindmutechange todo
mutechange
(
e
)
{
const
{
isMuted
}
=
e
.
detail
;
console
.
log
(
"bindmutechange:静音状态改变完成时触发"
,
"当前是否静音:"
+
isMuted
)
},
// bindcontroltap todo
controltap
(
e
)
{
const
{
controlType
}
=
e
.
detail
;
console
.
log
(
"bindcontroltap:点击控件时触发"
,
"controlType"
+
controlType
)
},
// bindenterbackground todo
enterbackground
()
{
console
.
log
(
"bindenterbackground:进入小窗播放时触发"
)
},
// bindclosebackground todo
closebackground
()
{
console
.
log
(
"bindclosebackground:关闭小窗播放时触发"
)
},
//bindgetsource
getsource
()
{
console
.
log
(
"bindgetsource:获取资源完成后触发"
)
}
},
};
</
script
>
<
style
>
.content
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
}
.title
{
font-size
:
36
rpx
;
color
:
#8f8f94
;
}
.player-content
{
width
:
370px
;
height
:
300px
;
}
</
style
>
\ No newline at end of file
vedio/pagesC/ttvideo/ttVideoDetail.vue
View file @
fb0b06a1
...
...
@@ -4,7 +4,7 @@
<swiper
class=
"swiper"
circular
@
change=
"swiperChange"
:current=
"current"
:vertical=
"true"
:duration=
"duration"
>
<swiper-item
v-for=
"(list, index) in displaySwiperList"
:key=
"index"
>
<block>
<video-player
v-if=
"canUseTTPlayer && Math.abs(displayIndex-index)==0"
:id=
"list.vedioIndex"
<
tt-
video-player
v-if=
"canUseTTPlayer && 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"
@
getsource=
"getsource"
:enable-progress-gesture=
"false"
:show-loading=
"true"
...
...
@@ -12,7 +12,7 @@
@
ended=
"ended"
@
click=
"tapVides()"
@
error=
"error"
>
<cover-view>
{{
list
.
douyinAlbumId
}}
</cover-view>
<cover-view>
{{
list
.
douyinEpisodeId
}}
</cover-view>
</video-player>
</
tt-
video-player>
<video
v-if=
"!canUseTTPlayer && Math.abs(displayIndex-index)==0"
:id=
"list.vedioIndex"
@
ended=
"ended"
:controls=
"controls"
:loop=
"!isplay"
:enable-progress-gesture=
"false"
...
...
@@ -83,6 +83,8 @@
import
coinPopup
from
'@/components/coin-popup/coin-popup.vue'
;
import
episodePopup
from
'@/components/episode-popup/episode-popup.vue'
;
import
ttVideoPlayer
from
'@/ttcomponents/tt-video-player'
import
{
navigateTo
,
}
from
'@/utils/fun.js'
;
...
...
@@ -95,7 +97,8 @@
mixins
:
[
common
],
components
:
{
coinPopup
,
episodePopup
episodePopup
,
ttVideoPlayer
},
data
()
{
return
{
...
...
@@ -138,7 +141,7 @@
})
// #ifdef MP-TOUTIAO
//
this.canUseTTPlayer = tt.canIUse('video-player')
this
.
canUseTTPlayer
=
tt
.
canIUse
(
'video-player'
)
if
(
this
.
canUseTTPlayer
&&
tt
.
canIUse
(
'preloadResourceVideo'
))
{
this
.
preloadplaylet
()
}
...
...
@@ -167,20 +170,15 @@
preloadplaylet
()
{
// 抖音预加载
tt
.
preloadResourceVideo
({
albumId
:
this
.
data
.
albumId
,
episodeId
:
this
.
data
.
episodeId
,
albumId
:
'7312714531850388019'
,
episodeId
:
'7312719321847529984'
,
cloudType
:
1
,
version
:
1
,
success
:
()
=>
{
this
.
setData
({
playletshow
:
true
,
});
console
.
log
(
"短剧预加载成功"
,
);
},
fail
:
(
error
)
=>
{
console
.
log
(
"短剧预加载失败"
,
error
);
this
.
setData
({
playletshow
:
true
,
});
},
});
},
...
...
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