IRMusicPlayer
- IRMusicPlayer 是一个强大的 iOS 音乐播放器。
特性
- 支持在线/本地播放。
- 支持显示音乐封面。
- 支持随机模式。
- 支持重复模式:重复所有音乐一次,重复当前音乐无限次,重复所有音乐无限次。
未来功能
- 支持后台播放。
安装
Git
- 克隆此项目。
- 将此项目复制到您自己的项目中。
- 将 .xcodeproj 添加到您的项目中,并链接为嵌入式框架。
选项
- 您可以删除
demo
和ScreenShots
文件夹。
Cocoapods
- 在
Podfile
中添加pod 'IRMusicPlayer'
。 pod install
使用方法
基本操作
@import IRMusicPlayer;
MusicPlayerViewController *vc = [[MusicPlayerViewController alloc] initWithNibName:@"MusicPlayerViewController" bundle:xibBundle];
[vc.musicListArray addObject:@{@"musicAddress": [[NSBundle mainBundle] pathForResource:@"1" ofType:@"mp3"]}];
[vc.musicListArray addObject:@{@"musicAddress": [[NSBundle mainBundle] pathForResource:@"2" ofType:@"mp3"]}];
[vc.musicListArray addObject:@{@"musicAddress": [[NSBundle mainBundle] pathForResource:@"3" ofType:@"mp3"]}];
[self presentViewController:vc animated:YES completion:nil];
高级设置
- 使用
MusicPlayerViewCallBackDelegate
。
@protocol MusicPlayerViewCallBackDelegate <NSObject>
-(void)didMusicChange:(NSString*)path;
@end
- 设置
musicIndex
以控制播放哪个音乐。
musicPlayerVC.musicIndex = 1;
[musicPlayerVC doPlay];
- 创建您自己的音乐封面图片。
musicPlayerVC.coverView.image = <Csutom image>;