EAMiniAudioPlayerView 是一个为 iOS 设计的迷你音频播放器视图,它只决定如何显示,但不管理如何下载和播放音频。
使用 Cocoapods 进行安装
pod install EAMiniAudioPlayerView
只需设置 EAMiniAudioPlayerStyleConfig
中的 playerStyle
属性,它是一个枚举:
typedef NS_ENUM(NSUInteger, EAMiniPlayerStyle) {
EAMiniPlayerNormal = 1 << 0, //Has play button,sound icon
EAMiniPlayerHidePlayButton = 1 << 1, //Hide play button
EAMiniPlayerHideSoundIcon = 1 << 2, //Hide sound icon
EAMiniPlayerHideText = 1 << 3, //Hide text label
};
例如:
EAMiniAudioPlayerStyleConfig *config = [EAMiniAudioPlayerStyleConfig defaultConfig];
config.playerStyle |= EAMiniPlayerHidePlayButton;
将值设置为 EAMiniAudioPlayerView
的 downloadProgress
属性(0 < downloadProgress < 1)可以更改下载进度。当 downloadProgress
的值大于或等于 1 时,将回调 void(^downloadCompleted)(void)
。
将值设置为 EAMiniAudioPlayerView
的 playProgress
属性(0 < downloadProgress < 1)可以更改播放进度。当 playProgress
的值大于或等于 1 时,将回调 void(^playCompleted)(void)
。
自定义圆角、边距、自定义颜色。