开发者

Can AVPlayer play MP3 files on iPad

开发者 https://www.devze.com 2023-03-11 04:17 出处:网络
Can AVPlayer place MP3 files? It does not l开发者_StackOverflow社区ist MP3 in the apple documentation.Did u try using

Can AVPlayer place MP3 files?

It does not l开发者_StackOverflow社区ist MP3 in the apple documentation.


Did u try using

   [[AVAudioPlayer alloc]initWithContentsOfURL:fileUrl error:nil];

to play the file


Yes it can play MP3.

Try reading the apple documentation here and specifically the section entitled "iOS Hardware and Software Audio Codecs"

Can AVPlayer play MP3 files on iPad


Here is a complete sample.

myClass.h:

- @interface myClass : NSObject \<AVAudioPlayerDelegate\> ...

myClass.m:

   localPlayer = [[AVAudioPlayer alloc]
   initWithContentsOfURL:newAudioURL error:nil]; [localPlayer
   setDelegate:self];

   - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)playedPlayer successfully:(BOOL)flag {
        NSLog(@"releasing");
        [playedPlayer release];
        NSLog(@"released"); }
0

精彩评论

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