测试已测试 | ✗ |
语言语言 | Obj-CObjective C |
许可协议 | MIT |
发布时间最后发布 | 2015年6月 |
由 Serg Krivoblotsky、Evgeniy Gurtovoy 维护。
基于 BASS-library 构建的低成本 iOS 音频播放器。
/*.m4a, *.mp3, *.mp2, *.mp1, *.wave, *.ogg, *.wav, *.aiff, *.opus, *.flac, *.wv. ... 以及更多我尚未测试的格式。
播放
- (BOOL)playItemWithURL:(NSURL *)url;
暂停
- (void)pause;
继续
- (void)resume;
是否正在播放?
- (BOOL)isPlaying;
获取当前曲目持续时间
- (NSTimeInterval)duration;
获取和设置当前曲目位置
/* Represents current position 0..1 */
@property (nonatomic, assign) CGFloat position;
获取和设置音量
//0..1
@property (nonatomic, assign) CGFloat volume;
/**
* Notifies the delegate about playing status changed
*
* @param player APAudioPlayer
*/
- (void)playerDidChangePlayingStatus:(APAudioPlayer *)player;
/**
* Will be called when track is over
*
* @param player APAudioPlayer
*/
- (void)playerDidFinishPlaying:(APAudioPlayer *)player;
/**
* Will be called when interruption occured. For ex. phone call. Basically you should call - (void)pause in this case.
*
* @param player APAudioPlayer
*/
- (void)playerBeginInterruption:(APAudioPlayer *)player;
/**
* Will be called when interruption ended. For ex. phone call ended. It's up to you to decide to call - (void)resume or not.
*
* @param player APAudioPlayer
* @param should BOOL
*/
- (void)playerEndInterruption:(APAudioPlayer *)player shouldResume:(BOOL)should;
Cocoapods
pod 'APAudioPlayer'
手动
//Somewhere during init
self.player = [APAudioPlayer new];
//Somewhere else
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"Meat Loaf - Dead Ringer" withExtension:@"wv"];
[self.player playItemWithURL:fileURL];
查看 示例 文件夹。
BASS 是一个用于多个平台软件的音频库。它的目的是为开发人员提供功能强大且高效的样本、流(MP3、MP2、MP1、OGG、WAV、AIFF、可通过 OS 编码器和附加组件生成等),MOD 音乐(XM、IT、S3M、MOD、MTM、UMX),MO3 音乐(MP3/OGG 压缩 MOD),以及录音功能。全部在一个紧凑的 DLL 中,不会使您的分发膨胀。
http://www.un4seen.com/bass.html#license
如果您有任何改进或问题,请随意提交 一个问题 并详细介绍。