Commit 3ed0d56e authored by liujiangnan's avatar liujiangnan

fix: 视频相关问题

parent e6e8ae29
...@@ -41,7 +41,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -41,7 +41,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initData() { initData() {
const middleLayer = cc.find('middleLayer'); const middleLayer = cc.find('middleLayer');
if (!middleLayer) { if (!middleLayer) {
cc.sys.localStorage.setItem('token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicGhvbmUiOiIxNTUwMDAwMDAwMSIsInNpZ24iOiI2NjAyMDk3ZS1iNjdmLTQ2ZjEtOTEyNC1lZmM4N2QzMmNmMjIiLCJpYXQiOjE2NTU4MDE1NzEsImV4cCI6MTY1ODM5MzU3MX0.JSdRYQKkzxQHAUqwvh4T9Rd8fe511wO92Dlk-R97EQg'); cc.sys.localStorage.setItem('token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicGhvbmUiOiIxNTUwMDAwMDAwMSIsInNpZ24iOiIyNWRmYjI4NS1mODIxLTRlMmQtOWI5NS1kM2I3ZDU5YmRjZDUiLCJpYXQiOjE2NTU4MDQ3MTAsImV4cCI6MTY1ODM5NjcxMH0.V2LzxdxnyWKF1rnbXAK8zyslurzOUq0bE_DEdWD5Cv0');
} }
this.token = cc.sys.localStorage.getItem("token"); this.token = cc.sys.localStorage.getItem("token");
} }
......
...@@ -79,7 +79,7 @@ export default class NewClass extends MyCocosSceneComponent { ...@@ -79,7 +79,7 @@ export default class NewClass extends MyCocosSceneComponent {
closeVideo() { closeVideo() {
this.videoplayer.stop(); this.videoplayer.stop();
if (this.playAudioId) { if (this.playAudioId!=null) {
cc.audioEngine.stop(this.playAudioId); cc.audioEngine.stop(this.playAudioId);
} }
this.dot.x = this.dotX; this.dot.x = this.dotX;
...@@ -97,15 +97,16 @@ export default class NewClass extends MyCocosSceneComponent { ...@@ -97,15 +97,16 @@ export default class NewClass extends MyCocosSceneComponent {
buttonOnClick(this.playBtn, () => { buttonOnClick(this.playBtn, () => {
this.videoplayer.play(); this.videoplayer.play();
if (this.playAudioId) { if (this.playAudioId!=null) {
cc.audioEngine.resume(this.playAudioId); cc.audioEngine.resume(this.playAudioId);
} }
}); });
this.videoplayer.node.on('clicked', () => { const mask = cc.find(`Canvas/videoContainer/mask`);
mask.on('click', () => {
if (this.videoplayer.isPlaying()) { if (this.videoplayer.isPlaying()) {
this.videoplayer.pause(); this.videoplayer.pause();
if (this.playAudioId) { if (this.playAudioId!=null) {
cc.audioEngine.pause(this.playAudioId); cc.audioEngine.pause(this.playAudioId);
} }
this.playBtn.active = true; this.playBtn.active = true;
...@@ -140,7 +141,9 @@ export default class NewClass extends MyCocosSceneComponent { ...@@ -140,7 +141,9 @@ export default class NewClass extends MyCocosSceneComponent {
console.error(err); console.error(err);
return; return;
} }
this.playAudioId = cc.audioEngine.play(audioClip, false, 1); if (this.videoplayer.isPlaying()) {
this.playAudioId = cc.audioEngine.play(audioClip, false, 1);
}
}); });
} }
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
"rawHeight": 10, "rawHeight": 10,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 5,
"borderRight": 0, "borderRight": 5,
"subMetas": {} "subMetas": {}
} }
} }
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
"rawHeight": 10, "rawHeight": 10,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 5,
"borderRight": 0, "borderRight": 5,
"subMetas": {} "subMetas": {}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment