Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DG_FAF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
DG_FAF
Commits
f3991b35
Commit
f3991b35
authored
Apr 13, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用转码视频
parent
8cbedf7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
DG_FAF.ts
assets/DG_FAF/scene/DG_FAF.ts
+5
-3
util_DG_FAF.ts
assets/DG_FAF/script/util_DG_FAF.ts
+15
-19
No files found.
assets/DG_FAF/scene/DG_FAF.ts
View file @
f3991b35
...
...
@@ -5,7 +5,8 @@ import {
asyncLoadRemote
,
getSprNode
,
playLocalAudio
,
asyncGetVideoDuration
asyncGetVideoDuration
,
getVideoUrl
}
from
"
../script/util_DG_FAF
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent_DG_FAF
"
;
import
{
getUUID
}
from
"
../script/util_DG_FAF
"
;
...
...
@@ -2499,8 +2500,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
showVideoLayer
();
const
videoplayer
=
cc
.
find
(
"
Canvas/VideoPlayerContainer/videoPlayer
"
).
getComponent
(
cc
.
VideoPlayer
)
videoplayer
.
stayOnBottom
=
true
;
if
(
videoplayer
.
remoteURL
!=
contentData
.
video_url
)
{
videoplayer
.
remoteURL
=
contentData
.
video_url
;
const
video_url
=
await
getVideoUrl
(
contentData
.
video_url
);
if
(
videoplayer
.
remoteURL
!=
video_url
)
{
videoplayer
.
remoteURL
=
video_url
;
}
this
.
videoDuration
=
await
asyncGetVideoDuration
(
videoplayer
);
// 设置进度条的起始和结束标签
...
...
assets/DG_FAF/script/util_DG_FAF.ts
View file @
f3991b35
...
...
@@ -454,7 +454,6 @@ export function httpHeadCall(requsetUrl: string, callback) {
try
{
xhr
.
onreadystatechange
=
()
=>
{
try
{
console
.
log
(
'
xhr.readyState:
'
,
xhr
.
readyState
);
if
(
xhr
.
readyState
==
4
)
{
if
((
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callback
(
true
);
...
...
@@ -534,22 +533,19 @@ export function asyncGetVideoDuration(video) {
resovle
(
dur
)
})
}
// 获取视频地址
// export function getVideoUrl(callback) {
// const url1 = this.data.video_url;
// // 强制使用原视频
// // console.log("强制使用原视频")
// // callback(url1);
// // return
// // ==== End ===
// const url2 = url1.replace(/.mp4$/g, "_h.mp4");
// this.httpHeadCall(url2, (success) => {
// if (success) {
// console.log('return url2: ', url2);
// callback(url2);
// } else {
// console.log('return url1: ', url1);
// callback(url1);
// }
// })
// }
export
function
getVideoUrl
(
video_url
)
{
return
new
Promise
((
resovle
,
reject
)
=>
{
const
video_url_h
=
video_url
.
replace
(
/.mp4$/g
,
"
_m.mp4
"
);
this
.
httpHeadCall
(
video_url_h
,
(
success
)
=>
{
if
(
success
)
{
// console.log('return video_url_h: ', video_url_h);
resovle
(
video_url_h
);
}
else
{
// console.log('return video_url: ', video_url);
resovle
(
video_url
);
}
})
})
}
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