actionscript3 中嵌入的 mp3 不会一直播放 [英] embedded mp3 in actionscript3 won't play all the way through

查看:21
本文介绍了actionscript3 中嵌入的 mp3 不会一直播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我嵌入了一个 mp3 文件,用作我的应用程序的背景音乐.虽然它工作正常,但问题是它没有播放整首曲目,它只播放前 32 秒(mp3 文件是 1:30 分钟).

I embedded an mp3 file be used as background music for my app. Though it works fine, the problem is that it doesn't play the whole track, it just plays the first 32 seconds of it (the mp3 file is 1:30 min).

这里有人知道为什么吗?

Does anyone here has any idea why?

我读过这里,也许声音没有不适合支持的 Flash Player 声音格式,但我认为这不是问题!文件不是那么大,但也许我错了?

I've read here that maybe the sound doesn't fit into the supported flash player sound format, but I don't think that's the problem! The file is not that big, but maybe I am wrong?

知道是什么导致了问题吗?或者怎么解决?代码很好,我很确定(它非常简单.只需嵌入 mp3,初始化所需的变量并播放声音.没什么特别的)

Any idea whats causing the problem? Or how to fix it? The code is fine, am sure of it (its pretty simple. Just embedded the mp3, initialized the required variable and played the sound. Nothing fancy)

编辑:mp3 以 44100 KHz 编码

EDIT: the mp3 is encoded at 44100 KHz

编辑这是代码,以防万一

package 
{
    import flash.display.Sprite;
    import flash.media.Sound;
    import flash.media.SoundChannel;

    public class BackgroundMusic extends Sprite
    {
        [Embed(source="swfs/bg.mp3")]       
        private var BG:Class;

        public function BackgroundMusic() 
        {   
            var backgroundMusic:Sound = new BG();
            backgroundMusic.play();
        }

    }
}

推荐答案

正如上述链接所暗示的,问题确实出在 mp3 文件本身上.基本上它太大了.因此,在将其从 44kHz 立体声 32 位降低到 44kHz 立体声 16 位后,它运行良好,现在它一直运行.话虽如此,但我们无法嵌入更高质量的 mp3 文件有点奇怪.我认为这个问题不会是加载(而不是嵌入)的问题,但我还没有测试过.如果这里有人有关于如何在不降低 mp3 质量的情况下解决此问题的想法,请分享

As the aforementioned link suggests, the problem was indeed with the mp3 file itself. Basically it was too big. So after reducing it from 44kHz stereo 32 bit to 44kHz stereo 16 bit it worked fine, and now it runs all the way through. With that said its kinda weird that we can't embed higher quality mp3 files. I presume that this problem wouldn't be an issue with loading (rather than embedding) but I haven't tested it. If anyone here has an idea on how to fix this problem without reducing the quality of the mp3 please share

这篇关于actionscript3 中嵌入的 mp3 不会一直播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆