Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: 8940
This problem only occurs on mobile devices (currently only Android phones have this problem) because it takes longer to load Audio resources on mobile devices than on computers.
The problem is that the loaded state of audioClip cannot be set directly when setting _nativeAsset, but should be set in the execution callback after the native resource is actually loaded, otherwise the audio will not be played when you click play for the first time on the mobile device. The engine is modified as follows:
因为在手机设备上加载 Audio 资源所需要的时间比在电脑上来得长,所以此问题只有出现在手机设备上。
问题原因是 audioClip 的 loaded 状态不能在设置 _nativeAsset 时就被直接设置,而应该是在原生资源真正被加载完成后的执行回调里设置,否则会导致在手机设备(目前只有 Android 手机会有此问题)上第一次点击播放时无法播放音频。引擎修改方法如下: