cpp
This commit is contained in:
		
							parent
							
								
									7e69ada2d2
								
							
						
					
					
						commit
						cb459dfcc9
					
				| @ -129,7 +129,8 @@ struct Index { | ||||
|         } | ||||
|         LogHelper.I("NativeSDK", "[Control Callback]: ") | ||||
|       }) | ||||
|       await registerSoundCallback(() => { | ||||
|       await registerSoundCallback((project: number, idx: number) => { | ||||
|         this.playAudio(project, idx) | ||||
|         LogHelper.I("NativeSDK", "[Sound Callback]: ") | ||||
|       }) | ||||
|       await setImageSize(500, 300) | ||||
| @ -143,11 +144,21 @@ struct Index { | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   async playAudio(project: number, point: number) { | ||||
|     await this.player.setSource({ | ||||
|       type: "raw", | ||||
|       url: audios[projectAudio[project][point]] | ||||
|     }) | ||||
|   // 播放语音 | ||||
|   async playAudio(project: number, idx: number) { | ||||
|     try { | ||||
|       await this.player.setSource({ | ||||
|         type: "raw", | ||||
|         url: audios[projectAudio[project][idx]] | ||||
|       }) | ||||
|     } catch (err) { | ||||
|       promptAction.showToast({ | ||||
|         message: JSON.stringify(err?.message || err), | ||||
|         duration: 3000 | ||||
|       }) | ||||
|       LogHelper.E("View", JSON.stringify(err?.message || err)) | ||||
|     } | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   // 初始化语音播放器 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user