@cc-component/cc-video 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ declare global {
25
25
  export function SetSize(param: { x: number, y: number, width: number, height: number })
26
26
  /**节点位置适配-自动适配 */
27
27
  export function AutoSize()
28
+ export function IsDebug();
28
29
  }
29
30
  }
30
31
  // // 必须在 game.init() 之前设置!
@@ -96,7 +96,7 @@ export class VideoManager {
96
96
  //console.log("视频:时间:", !this.baseVideo.getisPause(),data.position , currentName.end);
97
97
  if (this.isLoop) {
98
98
  if (data.position >= currentName.end_time && !this.baseVideo.getisPause()) {
99
- if (VideoManager.instance.Debug)
99
+ if (VideoModule.IsDebug())
100
100
  console.log("视频:播放结束:", currentName, !this.baseVideo.getisPause);
101
101
  await this.pause();
102
102
  this.currentIndex++;
@@ -46,6 +46,7 @@ export class VideoModule {
46
46
  }
47
47
 
48
48
  static Debug(enabled: boolean) { VideoManager.instance.Debug = enabled }
49
+ static IsDebug() { return VideoManager.instance.Debug }
49
50
  /**视频设置到指定大小 */
50
51
  static SetSize(param: { x: number, y: number, width: number, height: number }) { VideoManager.instance.setSize(param) }
51
52
  /**节点位置适配-自动适配 */
@@ -101,7 +101,8 @@ export class VideoPlayTT extends BaseVideo {
101
101
  // return
102
102
  // } else {
103
103
  // }
104
- console.warn('准备好了')
104
+ if (VideoModule.IsDebug())
105
+ console.warn('准备好了')
105
106
  this.videoTexture = new Texture2D();
106
107
  this.imgAsset.reset(this.videoPlayer);
107
108
  this.videoTexture.image = this.imgAsset;
@@ -184,15 +185,16 @@ export class VideoPlayTT extends BaseVideo {
184
185
  this.pauseFinish = resolve;
185
186
  this.videoPlayer.pause();
186
187
  this.isPlaying = false
187
-
188
- console.log("视频:暂停")
188
+ if (VideoModule.IsDebug())
189
+ console.log("视频:暂停")
189
190
  })
190
191
 
191
192
  }
192
193
  stop() {
193
194
  this.videoPlayer.stop();
194
195
  this.isPlaying = false
195
- console.log("视频:停止")
196
+ if (VideoModule.IsDebug())
197
+ console.log("视频:停止")
196
198
  this.canPlay = false;
197
199
 
198
200
  }
@@ -266,7 +268,8 @@ export class VideoPlayTT extends BaseVideo {
266
268
  this.video_sp.spriteFrame = null
267
269
  //this.videoPlayer.x = 2000;
268
270
  this.pause()
269
- console.warn('销毁了视频')
271
+ if (VideoModule.IsDebug())
272
+ console.warn('销毁了视频')
270
273
  this.isReady = false;
271
274
 
272
275
  this.videoPlayer.destroy()
@@ -122,13 +122,15 @@ export class VideoPlayWX extends BaseVideo {
122
122
  return new Promise<void>((resolve, reject) => {
123
123
  this.pauseFinish = resolve;
124
124
  this.videoPlayer.pause();
125
- console.log("视频:暂停")
125
+ if (VideoModule.IsDebug())
126
+ console.log("视频:暂停")
126
127
  })
127
128
  }
128
129
  stop() {
129
130
  this.videoPlayer.stop();
130
131
  this.isPlaying = false
131
- console.log("视频:停止")
132
+ if (VideoModule.IsDebug())
133
+ console.log("视频:停止")
132
134
 
133
135
  }
134
136
  resume() {
@@ -124,7 +124,8 @@ export class VideoPlayWeb extends BaseVideo {
124
124
  async pause() {
125
125
  this.videoPlayer.pause();
126
126
  this.isPlaying = false
127
- console.log("视频:暂停")
127
+ if (VideoModule.IsDebug())
128
+ console.log("视频:暂停")
128
129
 
129
130
  }
130
131
  stop() {
@@ -183,7 +184,8 @@ export class VideoPlayWeb extends BaseVideo {
183
184
  this.activeVideo(false)
184
185
  this.stop()
185
186
  this.isReady = false;
186
- console.log("视频:销毁")
187
+ if (VideoModule.IsDebug())
188
+ console.log("视频:销毁")
187
189
  }
188
190
  }
189
191
  activeVideo(isActive: boolean) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-video",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",