Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix audio can't be stopped on native platform #180

merged 3 commits into from Oct 12, 2019


Copy link

@PPpro PPpro commented Oct 12, 2019

Re: cocos/2d-tasks#1778 cocos/2d-tasks#1806


  • 修复原生平台 Audio 延迟加载,播放后无法停止的问题

engine/jsb-audio.js Outdated Show resolved Hide resolved
Copy link

jareguo commented Oct 12, 2019

这里只是为了解决异步加载时,无法及时获取原生 audio id 导致的管理问题。那其实更好的做法应该是在 js 层面向用户生成一套新的 id,在获取到原生 id 后在引擎内部再对 js 的 id 和原生的 id 做一个映射。之后可以考虑一下该方案

Copy link
Contributor Author

PPpro commented Oct 12, 2019

对,这是个临时方案,,,我觉得最好的方式还是 js 层可以拿到 Audio 对象,而不是 AudioID
我觉得这个是之后原生 Audio 的重构方向

engine/jsb-audio.js Outdated Show resolved Hide resolved
@holycanvas holycanvas merged commit ea202ec into cocos-creator-packages:v2.2.0-release Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants