@cc-component/cc-video 1.2.3 → 1.2.4
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.
|
@@ -217,6 +217,7 @@ export class VideoManager {
|
|
|
217
217
|
const isloop = false
|
|
218
218
|
const onRead = param.onRead
|
|
219
219
|
const onError = param.onError
|
|
220
|
+
|
|
220
221
|
param.onRead = () => {
|
|
221
222
|
console.warn('当前播放', name)
|
|
222
223
|
onRead?.()
|
|
@@ -273,8 +274,8 @@ export class VideoManager {
|
|
|
273
274
|
// 清理任务
|
|
274
275
|
if (VideoManager.instance.Debug)
|
|
275
276
|
console.log('任务已结束', oldTask?.count);
|
|
276
|
-
if (!param.isLoop)
|
|
277
|
-
|
|
277
|
+
// if (!param.isLoop && !this.stopRequested)
|
|
278
|
+
// param.onFinish?.()
|
|
278
279
|
//this.playTasks.delete(taskId);
|
|
279
280
|
});
|
|
280
281
|
}
|
|
@@ -87,22 +87,21 @@ export class VideoPlayTT extends BaseVideo {
|
|
|
87
87
|
const windowInfo = tt.getSystemInfoSync();
|
|
88
88
|
const { windowWidth, windowHeight } = windowInfo;
|
|
89
89
|
let video = tt.createOffscreenVideo();
|
|
90
|
-
video.onError(self.videoError)
|
|
91
|
-
video.onEnded(self.videoEnd);
|
|
92
|
-
video.onTimeUpdate(self.onUpdate)
|
|
93
|
-
video.onPlay(self.onPlay)
|
|
94
|
-
video.onPause(self.onPause)
|
|
90
|
+
video.onError(self.videoError.bind(self))
|
|
91
|
+
video.onEnded(self.videoEnd.bind(self));
|
|
92
|
+
video.onTimeUpdate(self.onUpdate.bind(self))
|
|
93
|
+
video.onPlay(self.onPlay.bind(self))
|
|
94
|
+
video.onPause(self.onPause.bind(self))
|
|
95
95
|
return video;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
onCanplay() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
console.warn('准备好了')
|
|
99
|
+
|
|
100
|
+
if (!this.canPlay) {
|
|
101
|
+
if (VideoModule.IsDebug())
|
|
102
|
+
console.warn('准备好了')
|
|
103
|
+
}
|
|
104
|
+
|
|
106
105
|
this.videoTexture = new Texture2D();
|
|
107
106
|
this.imgAsset.reset(this.videoPlayer);
|
|
108
107
|
this.videoTexture.image = this.imgAsset;
|
|
@@ -128,9 +127,8 @@ export class VideoPlayTT extends BaseVideo {
|
|
|
128
127
|
this.videoPlayer = this.createVideoWX(name, true)
|
|
129
128
|
this.actioveSelf(true)
|
|
130
129
|
|
|
131
|
-
|
|
132
|
-
this.videoPlayer.src = name;
|
|
133
130
|
this.videoPlayer.onCanplay(this.onCanplay.bind(this))
|
|
131
|
+
this.videoPlayer.src = name;
|
|
134
132
|
|
|
135
133
|
this.videoPlayer.loop = param.isLoop
|
|
136
134
|
const is_skip = name === this.remoteURL;
|
|
@@ -262,7 +260,7 @@ export class VideoPlayTT extends BaseVideo {
|
|
|
262
260
|
async destroyVideo() {
|
|
263
261
|
if (this.videoPlayer) {
|
|
264
262
|
|
|
265
|
-
|
|
263
|
+
this.canPlay = false
|
|
266
264
|
this.is_stop = true
|
|
267
265
|
this.actioveSelf(false)
|
|
268
266
|
this.video_sp.spriteFrame = null
|
|
@@ -300,7 +298,7 @@ export class VideoPlayTT extends BaseVideo {
|
|
|
300
298
|
var y = param.y - size.height + param.height / 2 * ratio //* ratio// + param.height / 2 * ratio
|
|
301
299
|
this.video_sp_ut.node.position = new Vec3(x, y, 0);
|
|
302
300
|
this.video_sp_ut.contentSize = new Size(width, height);
|
|
303
|
-
console.error(param.y, size)
|
|
301
|
+
// console.error(param.y, size)
|
|
304
302
|
}
|
|
305
303
|
}
|
|
306
304
|
|
|
@@ -74,11 +74,11 @@ export class VideoPlayWX extends BaseVideo {
|
|
|
74
74
|
objectFit: "cover",
|
|
75
75
|
//zIndex: -9999,//好大的坑 官方API根本没写这个
|
|
76
76
|
});
|
|
77
|
-
video.onError(self.videoError)
|
|
78
|
-
video.onEnded(self.videoEnd);
|
|
79
|
-
video.onTimeUpdate(self.onUpdate)
|
|
80
|
-
video.onPlay(self.onPlay)
|
|
81
|
-
video.onPause(self.onPause)
|
|
77
|
+
video.onError(self.videoError.bind(self))
|
|
78
|
+
video.onEnded(self.videoEnd.bind(self));
|
|
79
|
+
video.onTimeUpdate(self.onUpdate.bind(self))
|
|
80
|
+
video.onPlay(self.onPlay.bind(self))
|
|
81
|
+
video.onPause(self.onPause.bind(self))
|
|
82
82
|
return video;
|
|
83
83
|
}
|
|
84
84
|
|