Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sn03_playVideo
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
sn03_playVideo
Commits
2d7921af
Commit
2d7921af
authored
Oct 23, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复实体机器播放被遮挡的问题
parent
71939b6a
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
312 additions
and
318 deletions
+312
-318
sn03_playVideo.fire
assets/sn03_playVideo/Scene/sn03_playVideo.fire
+297
-290
sn03_playVideo.ts
assets/sn03_playVideo/Scene/sn03_playVideo.ts
+12
-25
bg_bottom.png.meta
...eo/prefab/JJ_Video_01/Texture/newVideo/bg_bottom.png.meta
+1
-1
bg_left.png.meta
...ideo/prefab/JJ_Video_01/Texture/newVideo/bg_left.png.meta
+1
-1
bg_right.png.meta
...deo/prefab/JJ_Video_01/Texture/newVideo/bg_right.png.meta
+1
-1
No files found.
assets/sn03_playVideo/Scene/sn03_playVideo.fire
View file @
2d7921af
This diff is collapsed.
Click to expand it.
assets/sn03_playVideo/Scene/sn03_playVideo.ts
View file @
2d7921af
...
@@ -52,7 +52,7 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -52,7 +52,7 @@ export default class VideoPlayerComponent extends cc.Component {
initSize
()
{
initSize
()
{
let
screen_size
=
cc
.
view
.
getFrameSize
().
width
/
cc
.
view
.
getFrameSize
().
height
;
let
screen_size
=
cc
.
view
.
getFrameSize
().
width
/
cc
.
view
.
getFrameSize
().
height
;
let
design_size
=
cc
.
Canvas
.
instance
.
designResolution
.
width
/
cc
.
Canvas
.
instance
.
designResolution
.
height
;
let
design_size
=
cc
.
Canvas
.
instance
.
designResolution
.
width
/
cc
.
Canvas
.
instance
.
designResolution
.
height
;
console
.
log
(
"
原本尺寸
"
,
screen_size
,
"
现在尺寸
"
,
design_size
)
let
f
=
screen_size
>=
design_size
;
let
f
=
screen_size
>=
design_size
;
cc
.
Canvas
.
instance
.
fitHeight
=
f
;
cc
.
Canvas
.
instance
.
fitHeight
=
f
;
cc
.
Canvas
.
instance
.
fitWidth
=
!
f
;
cc
.
Canvas
.
instance
.
fitWidth
=
!
f
;
...
@@ -71,9 +71,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -71,9 +71,6 @@ export default class VideoPlayerComponent extends cc.Component {
this
.
_mapScaleMin
=
Math
.
min
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMin
=
Math
.
min
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMax
=
Math
.
max
(
sx
,
sy
)
*
this
.
_cocosScale
;
this
.
_mapScaleMax
=
Math
.
max
(
sx
,
sy
)
*
this
.
_cocosScale
;
console
.
log
(
"
原本宽度
"
,
cc
.
director
[
"
_scene
"
].
width
,
"
现在宽度
"
,
frameSize
.
width
)
console
.
log
(
"
原本高度
"
,
cc
.
director
[
"
_scene
"
].
height
,
"
现在高度
"
,
frameSize
.
height
)
cc
.
director
[
"
_scene
"
].
width
=
frameSize
.
width
;
cc
.
director
[
"
_scene
"
].
width
=
frameSize
.
width
;
cc
.
director
[
"
_scene
"
].
height
=
frameSize
.
height
;
cc
.
director
[
"
_scene
"
].
height
=
frameSize
.
height
;
}
}
...
@@ -137,8 +134,8 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -137,8 +134,8 @@ export default class VideoPlayerComponent extends cc.Component {
cc
.
debug
.
setDisplayStats
(
false
);
cc
.
debug
.
setDisplayStats
(
false
);
this
.
initSize
();
this
.
initSize
();
cc
.
find
(
'
Canvas/bg
'
).
scale
=
this
.
_mapScaleMax
;
//
cc.find('Canvas/bg').scale = this._mapScaleMax;
cc
.
find
(
'
Canvas/video_node/bg
'
).
scale
=
this
.
_mapScaleMax
;
//
cc.find('Canvas/video_node/bg').scale = this._mapScaleMax;
// cc.find('Canvas/bgwhite').zIndex=-2
// cc.find('Canvas/bgwhite').zIndex=-2
// cc.find('Canvas/bg').zIndex=-1
// cc.find('Canvas/bg').zIndex=-1
...
@@ -208,20 +205,19 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -208,20 +205,19 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
});
});
this
.
videoPlayer
.
node
.
on
(
'
playing
'
,
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
playing
'
,
()
=>
{
console
.
log
(
'
playing
'
);
this
.
durationLabel
.
string
=
this
.
formatTime
(
this
.
videoPlayer
.
getDuration
());
this
.
durationLabel
.
string
=
this
.
formatTime
(
this
.
videoPlayer
.
getDuration
());
this
.
playButton
.
node
.
active
=
false
;
this
.
playButton
.
node
.
active
=
false
;
this
.
restartButton
.
node
.
active
=
false
;
this
.
restartButton
.
node
.
active
=
false
;
this
.
pauseButton
.
node
.
active
=
true
;
this
.
pauseButton
.
node
.
active
=
true
;
});
});
this
.
videoPlayer
.
node
.
on
(
'
paused
'
,
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
paused
'
,
()
=>
{
console
.
log
(
'
paused
'
);
});
});
this
.
videoPlayer
.
node
.
on
(
'
stopped
'
,
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
stopped
'
,
()
=>
{
console
.
log
(
'
stopped
'
);
});
});
this
.
videoPlayer
.
node
.
on
(
'
completed
'
,
async
()
=>
{
this
.
videoPlayer
.
node
.
on
(
'
completed
'
,
async
()
=>
{
console
.
log
(
'
completed
'
);
this
.
_isPlayComplated
=
true
;
this
.
_isPlayComplated
=
true
;
this
.
playButton
.
node
.
active
=
false
;
this
.
playButton
.
node
.
active
=
false
;
this
.
pauseButton
.
node
.
active
=
false
;
this
.
pauseButton
.
node
.
active
=
false
;
...
@@ -235,7 +231,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -235,7 +231,6 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
});
});
cc
.
view
.
setResizeCallback
(()
=>
{
cc
.
view
.
setResizeCallback
(()
=>
{
console
.
log
(
'
Resize
'
);
this
.
initdDrag
();
this
.
initdDrag
();
});
});
...
@@ -250,6 +245,7 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -250,6 +245,7 @@ export default class VideoPlayerComponent extends cc.Component {
if
(
this
.
videoItemList
)
if
(
this
.
videoItemList
)
cc
.
find
(
"
Canvas/btn_next
"
).
active
=
this
.
videoPlayIndex
!=
this
.
videoItemList
.
length
-
1
cc
.
find
(
"
Canvas/btn_next
"
).
active
=
this
.
videoPlayIndex
!=
this
.
videoItemList
.
length
-
1
}
}
onClickNext
(){
onClickNext
(){
const
nextItem
=
this
.
videoItemList
[
this
.
videoPlayIndex
+
1
];
const
nextItem
=
this
.
videoItemList
[
this
.
videoPlayIndex
+
1
];
if
(
nextItem
)
{
if
(
nextItem
)
{
...
@@ -259,6 +255,7 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -259,6 +255,7 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
this
.
refreshLastNextBtns
()
this
.
refreshLastNextBtns
()
}
}
onClickLast
(){
onClickLast
(){
const
nextItem
=
this
.
videoItemList
[
this
.
videoPlayIndex
-
1
];
const
nextItem
=
this
.
videoItemList
[
this
.
videoPlayIndex
-
1
];
if
(
nextItem
)
{
if
(
nextItem
)
{
...
@@ -272,7 +269,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -272,7 +269,6 @@ export default class VideoPlayerComponent extends cc.Component {
initListener
()
{
initListener
()
{
if
(
window
[
'
air
'
])
{
if
(
window
[
'
air
'
])
{
window
[
"
air
"
].
dialogStatus
=
(
statusCode
:
number
)
=>
{
window
[
"
air
"
].
dialogStatus
=
(
statusCode
:
number
)
=>
{
console
.
log
(
"
缓冲
"
,
statusCode
);
if
(
statusCode
==
701
)
{
if
(
statusCode
==
701
)
{
this
.
loadingSprite
.
active
=
true
;
this
.
loadingSprite
.
active
=
true
;
}
else
if
(
statusCode
==
702
)
{
}
else
if
(
statusCode
==
702
)
{
...
@@ -291,7 +287,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -291,7 +287,6 @@ export default class VideoPlayerComponent extends cc.Component {
if
(
!
this
.
_isReadyToPlay
)
{
if
(
!
this
.
_isReadyToPlay
)
{
return
;
return
;
}
}
console
.
log
(
"
TOUCH_START
"
);
});
});
this
.
barTag
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
);
this
.
barTag
.
off
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
);
this
.
barTag
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
)
=>
{
this
.
barTag
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
)
=>
{
...
@@ -313,7 +308,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -313,7 +308,6 @@ export default class VideoPlayerComponent extends cc.Component {
if
(
!
this
.
_isReadyToPlay
)
{
if
(
!
this
.
_isReadyToPlay
)
{
return
;
return
;
}
}
console
.
log
(
"
TOUCH_ENDED
"
);
this
.
updateBarByPos
(
this
.
barTag
.
x
);
this
.
updateBarByPos
(
this
.
barTag
.
x
);
});
});
this
.
barTag
.
off
(
cc
.
Node
.
EventType
.
MOUSE_UP
);
this
.
barTag
.
off
(
cc
.
Node
.
EventType
.
MOUSE_UP
);
...
@@ -321,7 +315,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -321,7 +315,6 @@ export default class VideoPlayerComponent extends cc.Component {
if
(
!
this
.
_isReadyToPlay
)
{
if
(
!
this
.
_isReadyToPlay
)
{
return
;
return
;
}
}
console
.
log
(
"
MOUSE_UP
"
);
this
.
updateBarByPos
(
this
.
barTag
.
x
);
this
.
updateBarByPos
(
this
.
barTag
.
x
);
});
});
}
}
...
@@ -441,9 +434,8 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -441,9 +434,8 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
cc
.
find
(
`Canvas/videolist`
).
active
=
this
.
data
.
dataArr
.
length
>
1
;
cc
.
find
(
`Canvas/videolist`
).
active
=
this
.
data
.
dataArr
.
length
>
1
;
if
(
this
.
data
.
dataArr
.
length
<=
1
){
if
(
this
.
data
.
dataArr
.
length
<=
1
){
console
.
log
(
"
qsj???
"
)
cc
.
find
(
`Canvas/video_node/videoBg`
).
scale
=
1.2
cc
.
find
(
`Canvas/bg/videoBg`
).
scale
=
1.2
cc
.
find
(
`Canvas/video_node/videoBg`
).
y
=-
136.058
cc
.
find
(
`Canvas/bg/videoBg`
).
y
=-
136.058
// cc.find(`Canvas/video_node`).scale=1.2
// cc.find(`Canvas/video_node`).scale=1.2
cc
.
find
(
`Canvas/video_node`
).
width
*=
1.2
cc
.
find
(
`Canvas/video_node`
).
width
*=
1.2
cc
.
find
(
`Canvas/video_node`
).
height
*=
1.2
cc
.
find
(
`Canvas/video_node`
).
height
*=
1.2
...
@@ -531,18 +523,15 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -531,18 +523,15 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
play
()
{
play
()
{
console
.
log
(
"
PL
"
)
if
(
!
this
.
_isReadyToPlay
)
{
if
(
!
this
.
_isReadyToPlay
)
{
return
;
return
;
}
}
const
{
width
,
height
}
=
cc
.
find
(
`Canvas/bg`
);
cc
.
find
(
`Canvas/text_tips`
).
active
=
false
;
cc
.
find
(
`Canvas/text_tips`
).
active
=
false
;
//
cc.find(`Canvas/bg`).active = false;
cc
.
find
(
`Canvas/bg`
).
active
=
false
;
cc
.
find
(
`Canvas/bgwhite`
).
active
=
false
;
cc
.
find
(
`Canvas/bgwhite`
).
active
=
false
;
const
videoContainer
=
cc
.
find
(
'
Canvas/video_node
'
);
const
videoContainer
=
cc
.
find
(
'
Canvas/video_node
'
);
cc
.
find
(
'
bg
'
,
videoContainer
).
width
=
width
;
cc
.
find
(
'
bg
'
,
videoContainer
).
height
=
height
;
this
.
videoPlayer
.
node
.
x
=
videoContainer
.
x
;
this
.
videoPlayer
.
node
.
x
=
videoContainer
.
x
;
this
.
videoPlayer
.
node
.
y
=
videoContainer
.
y
;
this
.
videoPlayer
.
node
.
y
=
videoContainer
.
y
;
this
.
videoPlayer
.
play
();
this
.
videoPlayer
.
play
();
...
@@ -682,8 +671,6 @@ export default class VideoPlayerComponent extends cc.Component {
...
@@ -682,8 +671,6 @@ export default class VideoPlayerComponent extends cc.Component {
}
}
update
(
dt
:
number
)
{
update
(
dt
:
number
)
{
console
.
log
(
"
==VIDEO==
"
,
this
.
node
.
active
);
if
(
!
this
.
_isReadyToPlay
)
{
if
(
!
this
.
_isReadyToPlay
)
{
return
;
return
;
}
}
...
...
assets/sn03_playVideo/prefab/JJ_Video_01/Texture/newVideo/bg_bottom.png.meta
View file @
2d7921af
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"type": "sprite",
"type": "sprite",
"wrapMode": "clamp",
"wrapMode": "clamp",
"filterMode": "bilinear",
"filterMode": "bilinear",
"premultiplyAlpha":
fals
e,
"premultiplyAlpha":
tru
e,
"genMipmaps": false,
"genMipmaps": false,
"packable": true,
"packable": true,
"width": 1920,
"width": 1920,
...
...
assets/sn03_playVideo/prefab/JJ_Video_01/Texture/newVideo/bg_left.png.meta
View file @
2d7921af
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"type": "sprite",
"type": "sprite",
"wrapMode": "clamp",
"wrapMode": "clamp",
"filterMode": "bilinear",
"filterMode": "bilinear",
"premultiplyAlpha":
fals
e,
"premultiplyAlpha":
tru
e,
"genMipmaps": false,
"genMipmaps": false,
"packable": true,
"packable": true,
"width": 223,
"width": 223,
...
...
assets/sn03_playVideo/prefab/JJ_Video_01/Texture/newVideo/bg_right.png.meta
View file @
2d7921af
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"type": "sprite",
"type": "sprite",
"wrapMode": "clamp",
"wrapMode": "clamp",
"filterMode": "bilinear",
"filterMode": "bilinear",
"premultiplyAlpha":
fals
e,
"premultiplyAlpha":
tru
e,
"genMipmaps": false,
"genMipmaps": false,
"packable": true,
"packable": true,
"width": 200,
"width": 200,
...
...
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