English | 中文
DOUAudioStreamer is a Core Audio based streaming audio player for iOS and macOS. It supports remote URLs, local files, and media library items through a small DOUAudioFile protocol.
- Streams and plays audio with Core Audio.
- Supports iOS and macOS.
- Provides playback status, duration, current time, buffering progress, cache path, and download speed.
- Supports playback control with
play,pause, andstop. - Includes optional audio analyzers and visualization helpers.
Add DOUAudioStreamer to your Podfile:
pod 'DOUAudioStreamer'Then run:
pod installDownload DOUAudioStreamer, then drag everything in the src folder into your Xcode project.
Create an object that conforms to DOUAudioFile:
#import "DOUAudioFile.h"
@interface Track : NSObject <DOUAudioFile>
@property (nonatomic, strong) NSURL *audioFileURL;
@endCreate a streamer and start playback:
#import "DOUAudioStreamer.h"
Track *track = [[Track alloc] init];
track.audioFileURL = [NSURL URLWithString:@"https://example.com/audio.mp3"];
DOUAudioStreamer *streamer = [DOUAudioStreamer streamerWithAudioFile:track];
[streamer play];You can observe the streamer's status property with KVO and inspect properties such as duration, currentTime, bufferingRatio, expectedLength, receivedLength, and downloadSpeed.
A working demonstration is included in the example folder.
- iOS 5.0+
- macOS 10.7+
- ARC
Use and distribution are licensed under the BSD license. See the LICENSE file for the full text.