Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MRBR_video
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
MRBR_video
Commits
bb6a3fd4
Commit
bb6a3fd4
authored
Nov 14, 2022
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加视频背景
parent
fccce5a8
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
269 additions
and
234 deletions
+269
-234
MRBR_video.fire
assets/MRBR_video/scene/MRBR_video.fire
+258
-226
MRBR_video.js
assets/MRBR_video/scene/MRBR_video.js
+11
-8
No files found.
assets/MRBR_video/scene/MRBR_video.fire
View file @
bb6a3fd4
This diff is collapsed.
Click to expand it.
assets/MRBR_video/scene/MRBR_video.js
View file @
bb6a3fd4
...
@@ -512,7 +512,7 @@ cc.Class({
...
@@ -512,7 +512,7 @@ cc.Class({
console
.
log
(
"
in addServerListener
"
);
console
.
log
(
"
in addServerListener
"
);
const
c
=
window
.
courseware
;
const
c
=
window
.
courseware
;
//
this.loadEnd();
this
.
loadEnd
();
if
(
!
c
)
{
if
(
!
c
)
{
return
;
return
;
}
}
...
@@ -782,10 +782,11 @@ cc.Class({
...
@@ -782,10 +782,11 @@ cc.Class({
},
},
// 设置视频背景
// 设置视频背景
initVideoBg
(
width
,
height
)
{
initVideoBg
(
width
,
height
,
scale
)
{
const
maskNode
=
cc
.
find
(
'
Canvas/video_bg
'
).
getComponent
(
cc
.
Mask
);
console
.
log
(
"
视频尺寸
"
,
width
,
height
,
scale
);
maskNode
.
width
=
width
;
const
bgNode
=
cc
.
find
(
'
Canvas/video_bg
'
)
maskNode
.
height
=
height
;
bgNode
.
width
=
width
*
scale
;
bgNode
.
height
=
height
*
scale
;
},
},
getVideoUrl
(
callback
)
{
getVideoUrl
(
callback
)
{
...
@@ -1054,22 +1055,24 @@ cc.Class({
...
@@ -1054,22 +1055,24 @@ cc.Class({
console
.
log
(
"
in initVideoRemote url:
"
,
url
);
console
.
log
(
"
in initVideoRemote url:
"
,
url
);
const
videoConfigSize
=
this
.
data
.
videoType
.
s
o
lit
(
'
_
'
);
const
videoConfigSize
=
this
.
data
.
videoType
.
s
p
lit
(
'
_
'
);
let
videoSizeW
=
1920
;
let
videoSizeW
=
1920
;
let
videoSizeH
=
1080
;
let
videoSizeH
=
1080
;
if
(
videoConfigSize
.
length
==
2
&&
!
isNaN
(
Number
(
videoConfigSize
[
0
]))
&&
!
isNaN
(
Number
(
videoConfigSize
[
1
])))
{
if
(
videoConfigSize
.
length
==
2
&&
!
isNaN
(
Number
(
videoConfigSize
[
0
]))
&&
!
isNaN
(
Number
(
videoConfigSize
[
1
])))
{
videoSizeW
=
Number
(
videoConfigSize
[
0
]);
videoSizeW
=
Number
(
videoConfigSize
[
0
]);
videoSizeH
=
Number
(
videoConfigSize
[
1
]);
videoSizeH
=
Number
(
videoConfigSize
[
1
]);
}
}
this
.
initVideoBg
(
videoSizeW
,
videoSizeH
);
const
scale
=
this
.
canvas
.
height
/
videoSizeH
;
this
.
initVideoBg
(
videoSizeW
,
videoSizeH
,
scale
);
const
videoRemoteNode
=
new
cc
.
Node
();
const
videoRemoteNode
=
new
cc
.
Node
();
videoRemoteNode
.
width
=
videoSizeW
;
videoRemoteNode
.
width
=
videoSizeW
;
videoRemoteNode
.
height
=
videoSizeH
;
videoRemoteNode
.
height
=
videoSizeH
;
videoRemoteNode
.
parent
=
this
.
canvas
;
videoRemoteNode
.
parent
=
this
.
canvas
;
// videoRemoteNode.y = -this.canvas.height * 1.5;
// videoRemoteNode.y = -this.canvas.height * 1.5;
videoRemoteNode
.
scale
=
this
.
canvas
.
height
/
videoSizeH
;
videoRemoteNode
.
scale
=
scale
;
const
video
=
videoRemoteNode
.
addComponent
(
cc
.
VideoPlayer
);
const
video
=
videoRemoteNode
.
addComponent
(
cc
.
VideoPlayer
);
video
.
resourceType
=
cc
.
VideoPlayer
.
ResourceType
.
REMOTE
;
video
.
resourceType
=
cc
.
VideoPlayer
.
ResourceType
.
REMOTE
;
...
...
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