Commit 8abaa35e authored by 李维's avatar 李维

feat: 调整视频播放器的初始位置

parent a54a0333
{"ver":"1.1.2","uuid":"25d9df1c-9ef4-4af7-9a5f-6d461ebda6f1","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": "25d9df1c-9ef4-4af7-9a5f-6d461ebda6f1",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, -9999,
0, 0,
0, 0,
0, 0,
...@@ -358,8 +358,8 @@ ...@@ -358,8 +358,8 @@
"alignMode": 1, "alignMode": 1,
"_target": null, "_target": null,
"_alignFlags": 45, "_alignFlags": 45,
"_left": 0, "_left": -9999,
"_right": 0, "_right": 9999,
"_top": 0, "_top": 0,
"_bottom": 0, "_bottom": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
......
...@@ -545,6 +545,8 @@ cc.Class({ ...@@ -545,6 +545,8 @@ cc.Class({
setTimeout(() => { setTimeout(() => {
this.videoCanPlay = true; this.videoCanPlay = true;
if (window && window["air"] && this.pageLoaded) { if (window && window["air"] && this.pageLoaded) {
cc.find("Canvas/VideoPlayer").x = 0;
this.alignVideoPlayer();
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
} }
}, 100); }, 100);
...@@ -569,13 +571,12 @@ cc.Class({ ...@@ -569,13 +571,12 @@ cc.Class({
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
console.log('preloadArr: ', JSON.stringify(preloadArr)); console.log('preloadArr: ', JSON.stringify(preloadArr));
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
this.videoplayer.remoteURL = this.data.video_url; this.videoplayer.remoteURL = this.data.video_url;
this.addServerListener(); this.addServerListener();
this.pageLoaded = true; this.pageLoaded = true;
if (window && window["air"] && this.videoCanPlay) { if (window && window["air"] && this.videoCanPlay) {
cc.find("Canvas/VideoPlayer").x = 0;
this.alignVideoPlayer();
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
} }
}); });
...@@ -678,21 +679,8 @@ cc.Class({ ...@@ -678,21 +679,8 @@ cc.Class({
} }
}, },
alignVideoPlayer() {
initView() {
this.initBg();
const canvas = cc.find('Canvas') const canvas = cc.find('Canvas')
this.videoplayer.node.on('ready-to-play', this.onReadyToPlay, this);
this.videoplayer.node.on('meta-loaded', this.onMetaLoaded, this);
this.videoplayer.node.on('clicked', this.onClicked, this);
this.videoplayer.node.on('playing', this.onPlaying, this);
// this.videoplayer.node.on('paused', this.onPaused, this);
// this.videoplayer.node.on('stopped', this.onStoped, this);
this.videoplayer.node.on('completed', this.onCompleted, this);
const playerWidget = this.videoplayer.getComponent(cc.Widget); const playerWidget = this.videoplayer.getComponent(cc.Widget);
if((canvas.width / canvas.height) >=1) { if((canvas.width / canvas.height) >=1) {
// 横屏 // 横屏
...@@ -706,6 +694,21 @@ cc.Class({ ...@@ -706,6 +694,21 @@ cc.Class({
playerWidget.enabled = true; playerWidget.enabled = true;
this.videoplayer.width = canvas.width; this.videoplayer.width = canvas.width;
} }
},
initView() {
this.initBg();
this.videoplayer.node.on('ready-to-play', this.onReadyToPlay, this);
this.videoplayer.node.on('meta-loaded', this.onMetaLoaded, this);
this.videoplayer.node.on('clicked', this.onClicked, this);
this.videoplayer.node.on('playing', this.onPlaying, this);
// this.videoplayer.node.on('paused', this.onPaused, this);
// this.videoplayer.node.on('stopped', this.onStoped, this);
this.videoplayer.node.on('completed', this.onCompleted, this);
this.alignVideoPlayer();
// this.initPic(); // this.initPic();
// this.initBtn(); // this.initBtn();
// this.initIcon(); // this.initIcon();
......
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