@cc-component/cc-video 1.2.2 → 1.2.3
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.
- package/assets/video/VideoComponent.prefab +4 -3
- package/assets/video/base/IVideo.ts +2 -0
- package/assets/video/base/VideoManager.ts +5 -0
- package/assets/video/base/VideoModule.ts +8 -0
- package/assets/video/base/VideoPlayTT.ts +5 -5
- package/assets/video/base/VideoPlayWX.ts +5 -5
- package/assets/video/base/VideoPlayWeb.ts +8 -5
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"_lpos": {
|
|
47
47
|
"__type__": "cc.Vec3",
|
|
48
48
|
"x": -540,
|
|
49
|
-
"y": 960,
|
|
49
|
+
"y": 960.0000000000001,
|
|
50
50
|
"z": 0
|
|
51
51
|
},
|
|
52
52
|
"_lrot": {
|
|
@@ -528,7 +528,7 @@
|
|
|
528
528
|
"_contentSize": {
|
|
529
529
|
"__type__": "cc.Size",
|
|
530
530
|
"width": 1080,
|
|
531
|
-
"height": 1920
|
|
531
|
+
"height": 1920.0000000000002
|
|
532
532
|
},
|
|
533
533
|
"_anchorPoint": {
|
|
534
534
|
"__type__": "cc.Vec2",
|
|
@@ -589,10 +589,11 @@
|
|
|
589
589
|
"__prefab": {
|
|
590
590
|
"__id__": 27
|
|
591
591
|
},
|
|
592
|
+
"des": "项目设置-宏配置-ENABLE_TRANSPARENT_CANVAS,开启透明画布",
|
|
592
593
|
"bundle_name": "video",
|
|
593
594
|
"video_dir": "video_dir",
|
|
594
595
|
"cover_dir": "cover_dir",
|
|
595
|
-
"remote_url": "https://hcy-cdn-domestic.wyx.cn/online/comeback/",
|
|
596
|
+
"remote_url": "https://hcy-cdn-domestic.wyx.cn/online/comeback/video_dy/",
|
|
596
597
|
"_id": ""
|
|
597
598
|
},
|
|
598
599
|
{
|
|
@@ -119,6 +119,7 @@ export class VideoManager {
|
|
|
119
119
|
this.baseVideo.onError = (err) => {
|
|
120
120
|
this.isError = true;
|
|
121
121
|
console.error("视频报错了 ", err)
|
|
122
|
+
this.param.onError?.()
|
|
122
123
|
};
|
|
123
124
|
|
|
124
125
|
this.baseVideo.onVideoEnd = () => {
|
|
@@ -215,11 +216,15 @@ export class VideoManager {
|
|
|
215
216
|
// console.log('加载视频', name)
|
|
216
217
|
const isloop = false
|
|
217
218
|
const onRead = param.onRead
|
|
219
|
+
const onError = param.onError
|
|
218
220
|
param.onRead = () => {
|
|
219
221
|
console.warn('当前播放', name)
|
|
220
222
|
onRead?.()
|
|
221
223
|
this.playVideo(param)
|
|
222
224
|
}
|
|
225
|
+
param.onError = () => {
|
|
226
|
+
onError?.()
|
|
227
|
+
}
|
|
223
228
|
this.loadVideo(name, param)
|
|
224
229
|
}
|
|
225
230
|
|
|
@@ -72,10 +72,14 @@ export class VideoModule {
|
|
|
72
72
|
if (param.isLocal === undefined)
|
|
73
73
|
param.isLocal = VideoModule.isLocal(video.name)
|
|
74
74
|
const onRead = param.onRead
|
|
75
|
+
const onError = param.onError
|
|
75
76
|
param.onRead = () => {
|
|
76
77
|
onRead?.()
|
|
77
78
|
VideoManager.instance.playVideo(param)
|
|
78
79
|
}
|
|
80
|
+
param.onError = () => {
|
|
81
|
+
onError?.()
|
|
82
|
+
}
|
|
79
83
|
VideoManager.instance.loadVideo(video.name, param)
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -87,10 +91,14 @@ export class VideoModule {
|
|
|
87
91
|
|
|
88
92
|
if (param.isPlayTime) {
|
|
89
93
|
const onRead = param.onRead
|
|
94
|
+
const onError = param.onError
|
|
90
95
|
param.onRead = () => {
|
|
91
96
|
onRead?.()
|
|
92
97
|
VideoManager.instance.playVideoList(video_list, param)
|
|
93
98
|
}
|
|
99
|
+
param.onError = () => {
|
|
100
|
+
onError?.()
|
|
101
|
+
}
|
|
94
102
|
VideoManager.instance.loadVideo(url, param)
|
|
95
103
|
} else {
|
|
96
104
|
VideoManager.instance.playVideoList(video_list, param)
|
|
@@ -87,11 +87,11 @@ 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)
|
|
91
|
+
video.onEnded(self.videoEnd);
|
|
92
|
+
video.onTimeUpdate(self.onUpdate)
|
|
93
|
+
video.onPlay(self.onPlay)
|
|
94
|
+
video.onPause(self.onPause)
|
|
95
95
|
return video;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -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)
|
|
78
|
+
video.onEnded(self.videoEnd);
|
|
79
|
+
video.onTimeUpdate(self.onUpdate)
|
|
80
|
+
video.onPlay(self.onPlay)
|
|
81
|
+
video.onPause(self.onPause)
|
|
82
82
|
return video;
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -45,9 +45,10 @@ export class VideoPlayWeb extends BaseVideo {
|
|
|
45
45
|
this.videoPlayer = comp
|
|
46
46
|
comp.enabled = true
|
|
47
47
|
// node.on(VideoPlayer.EventType.READY_TO_PLAY, this.readyPlay, this);
|
|
48
|
-
node.on(VideoPlayer.EventType.PLAYING, this.playIng
|
|
49
|
-
node.on(VideoPlayer.EventType.COMPLETED, this.videoEnd
|
|
50
|
-
node.on(VideoPlayer.EventType.ERROR, this.videoError
|
|
48
|
+
node.on(VideoPlayer.EventType.PLAYING, this.playIng, this);
|
|
49
|
+
node.on(VideoPlayer.EventType.COMPLETED, this.videoEnd, this);
|
|
50
|
+
node.on(VideoPlayer.EventType.ERROR, this.videoError, this);
|
|
51
|
+
console.error(node)
|
|
51
52
|
|
|
52
53
|
comp.resourceType = VideoPlayer.ResourceType.REMOTE;
|
|
53
54
|
comp.stayOnBottom = true;
|
|
@@ -78,6 +79,7 @@ export class VideoPlayWeb extends BaseVideo {
|
|
|
78
79
|
this.activeVideo(true)
|
|
79
80
|
if (!param.isTargetSize)
|
|
80
81
|
this.autoSize()
|
|
82
|
+
this.videoPlayer.clip = null
|
|
81
83
|
this.videoPlayer.clip = clip;
|
|
82
84
|
//this.videoPlayer.remoteURL = "";
|
|
83
85
|
this.videoPlayer.loop = param.isLoop
|
|
@@ -97,14 +99,15 @@ export class VideoPlayWeb extends BaseVideo {
|
|
|
97
99
|
if (!param.isTargetSize)
|
|
98
100
|
this.autoSize()
|
|
99
101
|
const is_skip = name === this.videoPlayer.remoteURL;
|
|
102
|
+
this.videoPlayer.remoteURL = ""
|
|
100
103
|
this.videoPlayer.remoteURL = name;
|
|
101
104
|
this.videoPlayer.resourceType = VideoPlayer.ResourceType.REMOTE;
|
|
102
105
|
this.videoPlayer.loop = param.isLoop
|
|
103
|
-
|
|
104
106
|
//console.warn('暂停', is_skip)
|
|
105
107
|
if (is_skip) {
|
|
106
108
|
this.isReady = true;
|
|
107
109
|
this.readyPlay()
|
|
110
|
+
//this.play()
|
|
108
111
|
} else {
|
|
109
112
|
this.play()
|
|
110
113
|
//this.pause();
|
|
@@ -160,7 +163,7 @@ export class VideoPlayWeb extends BaseVideo {
|
|
|
160
163
|
// if (!this.isloop) this.node.off(VideoPlayer.EventType.READY_TO_PLAY, this.readyPlay, this);
|
|
161
164
|
this.onRead?.(this)
|
|
162
165
|
}
|
|
163
|
-
private videoError() {
|
|
166
|
+
private videoError(error: any) {
|
|
164
167
|
this.onError?.();
|
|
165
168
|
}
|
|
166
169
|
|