More documentation. STKAutoRecoveringHTTPDataSource is now default for HTTP
This commit is contained in:
parent
b903ee58cc
commit
83bc40d5fc
|
|
@ -57,7 +57,7 @@
|
|||
{
|
||||
NSURL* url = [NSURL URLWithString:@"http://fs.bloom.fm/oss/audiosamples/sample.mp3"];
|
||||
|
||||
STKAutoRecoveringHTTPDataSource* dataSource = [[STKAutoRecoveringHTTPDataSource alloc] initWithHTTPDataSource:(STKHTTPDataSource*)[STKAudioPlayer dataSourceFromURL:url]];
|
||||
STKDataSource* dataSource = [STKAudioPlayer dataSourceFromURL:url];
|
||||
|
||||
[audioPlayer setDataSource:dataSource withQueueItemId:[[SampleQueueId alloc] initWithUrl:url andCount:0]];
|
||||
}
|
||||
|
|
@ -66,8 +66,10 @@
|
|||
{
|
||||
NSString* path = [[NSBundle mainBundle] pathForResource:@"airplane" ofType:@"aac"];
|
||||
NSURL* url = [NSURL fileURLWithPath:path];
|
||||
|
||||
STKDataSource* dataSource = [STKAudioPlayer dataSourceFromURL:url];
|
||||
|
||||
[audioPlayer queueDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:[[SampleQueueId alloc] initWithUrl:url andCount:0]];
|
||||
[audioPlayer queueDataSource:dataSource withQueueItemId:[[SampleQueueId alloc] initWithUrl:url andCount:0]];
|
||||
}
|
||||
|
||||
-(void) audioPlayerViewPlayFromLocalFileSelected:(AudioPlayerView*)audioPlayerView
|
||||
|
|
@ -75,7 +77,9 @@
|
|||
NSString* path = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"m4a"];
|
||||
NSURL* url = [NSURL fileURLWithPath:path];
|
||||
|
||||
[audioPlayer setDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:[[SampleQueueId alloc] initWithUrl:url andCount:0]];
|
||||
STKDataSource* dataSource = [STKAudioPlayer dataSourceFromURL:url];
|
||||
|
||||
[audioPlayer setDataSource:dataSource withQueueItemId:[[SampleQueueId alloc] initWithUrl:url andCount:0]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -130,6 +130,10 @@ STKAudioPlayerOptions;
|
|||
-(id) init;
|
||||
-(id) initWithReadBufferSize:(int)readBufferSizeIn andOptions:(STKAudioPlayerOptions)options;
|
||||
|
||||
/// Creates a datasource from a given URL
|
||||
/// URLs with FILE schemes will return an STKLocalFileDataSource
|
||||
/// URLs with HTTP schemes will return an STKHTTPDataSource wrapped within an STKAutoRecoveringHTTPDataSource
|
||||
/// URLs with unrecognised schemes will return nil
|
||||
+(STKDataSource*) dataSourceFromURL:(NSURL*)url;
|
||||
/// Plays an item from the given URL (all pending queued items are removed)
|
||||
-(void) play:(NSString*)urlString;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#import "STKAudioPlayer.h"
|
||||
#import "AudioToolbox/AudioToolbox.h"
|
||||
#import "STKHTTPDataSource.h"
|
||||
#import "STKAutoRecoveringHTTPDataSource.h"
|
||||
#import "STKLocalFileDataSource.h"
|
||||
#import "STKQueueEntry.h"
|
||||
#import "NSMutableArray+STKAudioPlayer.h"
|
||||
|
|
@ -367,15 +368,15 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
|
|||
|
||||
+(STKDataSource*) dataSourceFromURL:(NSURL*)url
|
||||
{
|
||||
STKDataSource* retval;
|
||||
STKDataSource* retval = nil;
|
||||
|
||||
if ([url.scheme isEqualToString:@"file"])
|
||||
{
|
||||
retval = [[STKLocalFileDataSource alloc] initWithFilePath:url.path];
|
||||
}
|
||||
else
|
||||
else if ([url.scheme isEqualToString:@"http"] || [url.scheme isEqualToString:@"https"])
|
||||
{
|
||||
retval = [[STKHTTPDataSource alloc] initWithURL:url];
|
||||
retval = [[STKAutoRecoveringHTTPDataSource alloc] initWithHTTPDataSource:[[STKHTTPDataSource alloc] initWithURL:url]];
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
|
|
|||
Loading…
Reference in New Issue