diff --git a/cocos/video/video-player-enums.ts b/cocos/video/video-player-enums.ts index bab22f8ebe..a456ade0e4 100644 --- a/cocos/video/video-player-enums.ts +++ b/cocos/video/video-player-enums.ts @@ -56,48 +56,48 @@ export enum EventType { * @en None * @zh 无 */ - NONE, + NONE = 'none', /** * @en The video is playing. * @zh 视频播放中 */ - PLAYING, + PLAYING = 'playing', /** * @en Video paused * @zh 视频暂停中 */ - PAUSED, + PAUSED = 'paused', /** * @en Video stopped * @zh 视频停止中 */ - STOPPED, + STOPPED = 'stopped', /** * @en End of video * @zh 视频播放完毕 */ - COMPLETED, + COMPLETED = 'completed', /** * @en Video metadata loading complete * @zh 视频元数据加载完毕 */ - META_LOADED, + META_LOADED = 'meta-loaded', /** * @en The video is ready to play when loaded * @zh 视频加载完毕可播放 */ - READY_TO_PLAY, + READY_TO_PLAY = 'ready-to-play', /** * @en Video Trigger Error * @zh 处理视频时触发的错误 */ - ERROR, + ERROR = 'error', /** * @en Video clicked * @zh 视频被点击 */ - CLICKED, + CLICKED = 'clicked', } export enum READY_STATE { diff --git a/cocos/video/video-player.ts b/cocos/video/video-player.ts index d113909663..5a99d90ea8 100644 --- a/cocos/video/video-player.ts +++ b/cocos/video/video-player.ts @@ -425,32 +425,32 @@ export class VideoPlayer extends Component { public onReadyToPlay () { if (this._playOnAwake && !this.isPlaying) { this.play(); } ComponentEventHandler.emitEvents(this.videoPlayerEvent, this, EventType.READY_TO_PLAY); - this.node.emit('ready-to-play', this); + this.node.emit(EventType.READY_TO_PLAY, this); } public onPlaying () { ComponentEventHandler.emitEvents(this.videoPlayerEvent, this, EventType.PLAYING); - this.node.emit('playing', this); + this.node.emit(EventType.PLAYING, this); } public onPasued () { ComponentEventHandler.emitEvents(this.videoPlayerEvent, this, EventType.PAUSED); - this.node.emit('paused', this); + this.node.emit(EventType.PAUSED, this); } public onStopped () { ComponentEventHandler.emitEvents(this.videoPlayerEvent, this, EventType.STOPPED); - this.node.emit('stopped', this); + this.node.emit(EventType.STOPPED, this); } public onCompleted () { ComponentEventHandler.emitEvents(this.videoPlayerEvent, this, EventType.COMPLETED); - this.node.emit('completed', this); + this.node.emit(EventType.COMPLETED, this); } public onError () { ComponentEventHandler.emitEvents(this.videoPlayerEvent, this, EventType.ERROR); - this.node.emit('error', this); + this.node.emit(EventType.ERROR, this); } /** diff --git a/cocos/web-view/web-view-enums.ts b/cocos/web-view/web-view-enums.ts index 973dd64ede..0c1df446a3 100644 --- a/cocos/web-view/web-view-enums.ts +++ b/cocos/web-view/web-view-enums.ts @@ -33,20 +33,20 @@ export enum EventType { * @en None * @zh 无 */ - NONE, + NONE = 'none', /** * @en Web page Load completed. * @zh 网页加载完成 */ - LOADING, + LOADING = 'loading', /** * @en Web page is loading. * @zh 网页加载中 */ - LOADED, + LOADED = 'loaded', /** * @en Web page error occurs when loading. * @zh 网页加载出错 */ - ERROR, + ERROR = 'error', } diff --git a/cocos/web-view/web-view.ts b/cocos/web-view/web-view.ts index cb0c9af79e..2b62f14dd1 100644 --- a/cocos/web-view/web-view.ts +++ b/cocos/web-view/web-view.ts @@ -180,17 +180,17 @@ export class WebView extends Component { onLoading () { ComponentEventHandler.emitEvents(this.webviewEvents, this, EventType.LOADING); - this.node.emit('loading', this); + this.node.emit(EventType.LOADING, this); } onLoaded () { ComponentEventHandler.emitEvents(this.webviewEvents, this, EventType.LOADED); - this.node.emit('loaded', this); + this.node.emit(EventType.LOADED, this); } onError () { ComponentEventHandler.emitEvents(this.webviewEvents, this, EventType.ERROR); - this.node.emit('error', this); + this.node.emit(EventType.ERROR, this); } public onEnable () {