Added additional queue/play methods
This commit is contained in:
parent
55a96578b4
commit
f725ed0b2c
|
|
@ -40,8 +40,8 @@ STKAudioPlayer* audioPlayer = [[STKAudioPlayer alloc] init];
|
|||
```objective-c
|
||||
STKAudioPlayer* audioPlayer = [[STKAudioPlayer alloc] init];
|
||||
|
||||
[audioPlayer queueDataSource:[STKAudioPlayer dataSourceFromURL:@"http://fs.bloom.fm/oss/audiosamples/sample.mp3"]];
|
||||
[audioPlayer queueDataSource:[STKAudioPlayer dataSourceFromURL:@"http://fs.bloom.fm/oss/audiosamples/airplane.aac"]];
|
||||
[audioPlayer queue:@"http://fs.bloom.fm/oss/audiosamples/sample.mp3"];
|
||||
[audioPlayer queue:@"http://fs.bloom.fm/oss/audiosamples/airplane.aac"];
|
||||
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -149,16 +149,40 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn
|
|||
/// Initializes a new STKAudioPlayer with the given options
|
||||
-(id) initWithOptions:(STKAudioPlayerOptions)optionsIn;
|
||||
|
||||
/// Plays an item from the given URL (all pending queued items are removed)
|
||||
/// Plays an item from the given URL string (all pending queued items are removed).
|
||||
/// The NSString is used as the queue item ID
|
||||
-(void) play:(NSString*)urlString;
|
||||
|
||||
/// Plays an item from the given URL (all pending queued items are removed)
|
||||
-(void) playWithURL:(NSURL*)url;
|
||||
-(void) play:(NSString*)urlString withQueueItemID:(NSObject*)queueItemId;
|
||||
|
||||
/// Plays an item from the given URL (all pending queued items are removed)
|
||||
/// The NSURL is used as the queue item ID
|
||||
-(void) playURL:(NSURL*)url;
|
||||
|
||||
/// Plays an item from the given URL (all pending queued items are removed)
|
||||
-(void) playURL:(NSURL*)url withQueueItemID:(NSObject*)queueItemId;
|
||||
|
||||
/// Plays the given item (all pending queued items are removed)
|
||||
-(void) playWithDataSource:(STKDataSource*)dataSource;
|
||||
/// The STKDataSource is used as the queue item ID
|
||||
-(void) playDataSource:(STKDataSource*)dataSource;
|
||||
|
||||
/// Queues a DataSource with te given Item ID for playback
|
||||
/// Plays the given item (all pending queued items are removed)
|
||||
-(void) playDataSource:(STKDataSource*)dataSource withQueueItemID:(NSObject*)queueItemId;
|
||||
|
||||
/// Queues the URL string for playback and uses the NSString as the queueItemID
|
||||
-(void) queue:(NSString*)urlString;
|
||||
|
||||
/// Queues the URL string for playback with the given queueItemID
|
||||
-(void) queue:(NSString*)urlString withQueueItemId:(NSObject*)queueItemId;
|
||||
|
||||
/// Queues the URL for playback and uses the NSURL as the queueItemID
|
||||
-(void) queueURL:(NSURL*)url;
|
||||
|
||||
/// Queues the URL for playback with the given queueItemID
|
||||
-(void) queueURL:(NSURL*)url withQueueItemId:(NSObject*)queueItemId;
|
||||
|
||||
/// Queues a DataSource with the given queueItemId
|
||||
-(void) queueDataSource:(STKDataSource*)dataSource withQueueItemId:(NSObject*)queueItemId;
|
||||
|
||||
/// Plays the given item (all pending queued items are removed)
|
||||
|
|
|
|||
|
|
@ -481,20 +481,35 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
|
|||
}
|
||||
|
||||
-(void) play:(NSString*)urlString
|
||||
{
|
||||
[self play:urlString withQueueItemID:urlString];
|
||||
}
|
||||
|
||||
-(void) play:(NSString*)urlString withQueueItemID:(NSObject*)queueItemId
|
||||
{
|
||||
NSURL* url = [NSURL URLWithString:urlString];
|
||||
|
||||
[self setDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:urlString];
|
||||
[self setDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:queueItemId];
|
||||
}
|
||||
|
||||
-(void) playWithURL:(NSURL*)url
|
||||
-(void) playURL:(NSURL*)url
|
||||
{
|
||||
[self setDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:url];
|
||||
[self playURL:url withQueueItemID:url];
|
||||
}
|
||||
|
||||
-(void) playWithDataSource:(STKDataSource*)dataSource
|
||||
-(void) playURL:(NSURL*)url withQueueItemID:(NSObject*)queueItemId
|
||||
{
|
||||
[self setDataSource:dataSource withQueueItemId:dataSource];
|
||||
[self setDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:queueItemId];
|
||||
}
|
||||
|
||||
-(void) playDataSource:(STKDataSource*)dataSource
|
||||
{
|
||||
[self playDataSource:dataSource withQueueItemID:dataSource];
|
||||
}
|
||||
|
||||
-(void) playDataSource:(STKDataSource*)dataSource withQueueItemID:(NSObject *)queueItemId
|
||||
{
|
||||
[self setDataSource:dataSource withQueueItemId:queueItemId];
|
||||
}
|
||||
|
||||
-(void) setDataSource:(STKDataSource*)dataSourceIn withQueueItemId:(NSObject*)queueItemId
|
||||
|
|
@ -516,6 +531,26 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
|
|||
[self wakeupPlaybackThread];
|
||||
}
|
||||
|
||||
-(void) queue:(NSString*)urlString
|
||||
{
|
||||
return [self queueURL:[NSURL URLWithString:urlString] withQueueItemId:urlString];
|
||||
}
|
||||
|
||||
-(void) queue:(NSString*)urlString withQueueItemId:(NSObject*)queueItemId
|
||||
{
|
||||
[self queueURL:[NSURL URLWithString:urlString] withQueueItemId:queueItemId];
|
||||
}
|
||||
|
||||
-(void) queueURL:(NSURL*)url
|
||||
{
|
||||
[self queueURL:url withQueueItemId:url];
|
||||
}
|
||||
|
||||
-(void) queueURL:(NSURL*)url withQueueItemId:(NSObject*)queueItemId
|
||||
{
|
||||
[self queueDataSource:[STKAudioPlayer dataSourceFromURL:url] withQueueItemId:queueItemId];
|
||||
}
|
||||
|
||||
-(void) queueDataSource:(STKDataSource*)dataSourceIn withQueueItemId:(NSObject*)queueItemId
|
||||
{
|
||||
pthread_mutex_lock(&playerMutex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue