开发者

Flex 4 Sound class -- detect sample rate of .mp3

开发者 https://www.devze.com 2023-02-16 05:59 出处:网络
I\'m working on an Adobe Air application written in Flex 4 that plays .mp3 audio files on the user\'s computer. Note: these are are not audio files shipped with the application -- they are .mp3\'s on

I'm working on an Adobe Air application written in Flex 4 that plays .mp3 audio files on the user's computer. Note: these are are not audio files shipped with the application -- they are .mp3's on the user's computer that they select for playback through the application.

The application works fine for .mp3s encod开发者_如何学Pythoned at 44.1 kHz, but can give unpredictable results if other sample rates are used. I've done plenty of research to know the limitations of the Sound class and how .mp3 will basically be my only option in Flex.

My question is: Is there a way to detect the sample rate of the .mp3 audio in Flex 4 ActionScript?

Rather than worry about making the application work well with non-standard sample rates, at this point I'd like to just catch those cases and prevent files with non-44.1 kHz sample rates from loading.

To be specific: if a user selects an .mp3 for playback that has been encoded at 48 kHz, for example, I'd like to be able to detect that case and take action preventing the file from loading and then announce to the user that this is not a supported audio file.

Thanks in advance, Fitz


Use mp3infoutil

0

精彩评论

暂无评论...
验证码 换一张
取 消