Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_video_01
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
op_video_01
Commits
c4520b36
Commit
c4520b36
authored
Jul 27, 2022
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
e580a2b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
35 deletions
+145
-35
op_video_01.meta
assets/op_video_01.meta
+15
-1
op_video_01.js
assets/op_video_01/scene/op_video_01.js
+130
-34
No files found.
assets/op_video_01.meta
View file @
c4520b36
{"ver":"1.1.2","uuid":"65997238-1dce-4fd5-a9a7-ea94159b589f","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
{
\ No newline at end of file
"ver": "1.1.2",
"uuid": "65997238-1dce-4fd5-a9a7-ea94159b589f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
assets/op_video_01/scene/op_video_01.js
View file @
c4520b36
...
@@ -94,7 +94,7 @@ cc.Class({
...
@@ -94,7 +94,7 @@ cc.Class({
// 生命周期 onLoad
// 生命周期 onLoad
onLoad
()
{
onLoad
()
{
//
this.initSceneData();
this
.
initSceneData
();
this
.
initSize
();
this
.
initSize
();
this
.
_armatureDisPlay
=
this
.
cat
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
this
.
_armatureDisPlay
=
this
.
cat
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
//获取 Armatrue
//获取 Armatrue
...
@@ -211,16 +211,16 @@ cc.Class({
...
@@ -211,16 +211,16 @@ cc.Class({
},
},
hideRabbit
()
{
hideRabbit
()
{
console
.
log
(
'
hideRabbit
'
);
//
console.log('hideRabbit');
if
(
window
&&
window
[
"
air
"
])
{
//
if (window && window["air"]) {
window
.
air
.
onCourseInScreen
=
(
next
)
=>
{
//
window.air.onCourseInScreen = (next) => {
this
.
playGame
();
//
this.playGame();
next
();
//
next();
}
//
}
window
[
"
air
"
].
hideAirClassLoading
();
//
window["air"].hideAirClassLoading();
}
else
{
//
} else {
this
.
playGame
();
//
this.playGame();
}
//
}
},
},
playGame
()
{
playGame
()
{
...
@@ -290,14 +290,14 @@ cc.Class({
...
@@ -290,14 +290,14 @@ cc.Class({
//
_imageResList: null,
_imageResList
:
null
,
//
_audioResList: null,
_audioResList
:
null
,
//
_animaResList: null,
_animaResList
:
null
,
//
initSceneData() {
initSceneData
()
{
//
this._imageResList = [];
this
.
_imageResList
=
[];
//
this._audioResList = [];
this
.
_audioResList
=
[];
//
this._animaResList = [];
this
.
_animaResList
=
[];
//
},
},
_designSize
:
null
,
// 设计分辨率
_designSize
:
null
,
// 设计分辨率
_frameSize
:
null
,
// 屏幕分辨率
_frameSize
:
null
,
// 屏幕分辨率
...
@@ -505,12 +505,108 @@ cc.Class({
...
@@ -505,12 +505,108 @@ cc.Class({
// const d = this.data.video_url.lastIndexOf('.');
// const d = this.data.video_url.lastIndexOf('.');
// const u = this.data.video_url.substring(0, d) + '_l' + this.data.video_url.substring(d)
// const u = this.data.video_url.substring(0, d) + '_l' + this.data.video_url.substring(d)
// console.log('video', u);
// console.log('video', u);
this
.
videoplayer
.
remoteURL
=
this
.
data
.
video_url
;
this
.
addPreloadAudio
(()
=>
{
this
.
preload
();
});
cc
.
debug
.
setDisplayStats
(
false
);
cc
.
debug
.
setDisplayStats
(
false
);
},
},
preload
()
{
const
preloadArr
=
this
.
_imageResList
.
concat
(
this
.
_audioResList
).
concat
(
this
.
_animaResList
);
console
.
log
(
'
preloadArr:
'
,
JSON
.
stringify
(
preloadArr
)
);
cc
.
assetManager
.
loadAny
(
preloadArr
,
null
,
null
,
(
err
,
data
)
=>
{
this
.
videoplayer
.
remoteURL
=
this
.
data
.
video_url
;
// this.addServerListener();
// if (window && window["air"]) {
// window["air"].hideAirClassLoading();
// }
});
},
addPreloadAudio
(
callback
)
{
this
.
_audioResList
.
push
({
url
:
this
.
data
.
finish_audio_url
||
''
});
this
.
_audioResList
.
push
({
url
:
this
.
data
.
hint_audio_url
||
''
});
const
url1
=
this
.
data
.
video_url
;
if
(
!
url1
)
{
callback
();
return
;
}
this
.
getVideoUrl
((
url
)
=>
{
console
.
log
(
'
url:
'
,
url
);
this
.
data
.
video_url
=
url
;
this
.
_audioResList
.
push
({
url
:
url
||
''
});
callback
();
})
},
getVideoUrl
(
callback
)
{
const
url1
=
this
.
data
.
video_url
;
const
url2
=
url1
.
replace
(
/.mp4$/g
,
"
_l.mp4
"
);
this
.
httpHeadCall
(
url2
,
(
success
)
=>
{
if
(
success
)
{
console
.
log
(
'
return url2:
'
,
url2
);
callback
(
url2
);
}
else
{
console
.
log
(
'
return url1:
'
,
url1
);
callback
(
url1
);
}
})
},
httpHeadCall
(
requsetUrl
,
callback
)
{
let
xhr
=
new
XMLHttpRequest
();
console
.
log
(
"
Status: Send Post Request to
"
+
requsetUrl
);
try
{
xhr
.
onreadystatechange
=
()
=>
{
try
{
console
.
log
(
'
xhr.readyState:
'
,
xhr
.
readyState
);
if
(
xhr
.
readyState
==
4
)
{
if
((
xhr
.
status
>=
200
&&
xhr
.
status
<
400
))
{
callback
(
true
);
}
else
{
callback
(
false
);
}
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
};
xhr
.
open
(
"
HEAD
"
,
requsetUrl
,
true
);
xhr
.
send
();
xhr
.
timeout
=
15000
;
xhr
.
onerror
=
(
e
)
=>
{
console
.
log
(
"
汪汪汪 posterror
"
,
e
);
callback
(
false
);
};
xhr
.
ontimeout
=
(
e
)
=>
{
console
.
log
(
"
汪汪汪 ontimeout
"
,
e
);
callback
(
false
);
};
}
catch
(
e
)
{
console
.
log
(
"
Send Get Request error:
"
,
e
)
}
},
...
...
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