Adobe AIR for iPhone 应用程序:无法正常播放音频

发布于 2024-12-19 14:20:31 字数 214 浏览 2 评论 0原文

我刚刚使用adobe air开发了一个应用程序。它包含一些带有mp3 格式背景音乐的动画。问题是动画播放时音乐很生涩…… 仅供参考,这是我在 flash 中播放音频的方式:new Sound(new URLRequest("m3.mp3")).play() 我做错了什么吗?

顺便说一句,有趣的是,如果你点击主页按钮,然后再次返回应用程序,一切都会播放得很漂亮......

I just developed an App by using adobe air. It contains some animations with background music in mp3 format. The problem is that the music is very jerky when the animation is playing...
FYI, this is the way how I play audio in flash:new Sound(new URLRequest("m3.mp3")).play()
Have I done anything wrong?

BTW, the funny thing is that if you hit the HOME button, and then come back to the app again, everything plays beautifully...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白芷 2024-12-26 14:20:31

在不了解更多代码的情况下,声音似乎没有完全加载。文件会尽可能播放,然后等待更多数据显示,然后继续。 。 。非常生涩。您可能需要等待声音完全加载才能播放:

var s = new air.Sound(); 
s.addEventListener(air.Event.COMPLETE, onSoundLoaded); 
var req = new air.URLRequest("bigSound.mp3"); 
s.load(req); 

function onSoundLoaded(event) 
{ 
    var localSound = event.target; 
    localSound.play(); 
}

此代码来自 Adobe 的声音文档

Without knowing more about the code, it seems like the sound is not fully loaded. The file plays as far as it can, then waits for more data to show up, then continues . . . very jerky. You may have to wait for the sound to load completely before playing it:

var s = new air.Sound(); 
s.addEventListener(air.Event.COMPLETE, onSoundLoaded); 
var req = new air.URLRequest("bigSound.mp3"); 
s.load(req); 

function onSoundLoaded(event) 
{ 
    var localSound = event.target; 
    localSound.play(); 
}

This code is from Adobe's Sound docs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文