AudioStreamPlayer
@interface AudioStreamPlayer : NSObject {
NSURL *url;
AudioQueueRef audioQueue;
AudioFileStreamID audioFileStream;
AudioFileID audioFile;
AudioStreamBasicDescription asbd;
NSThread *internalThread;
AudioQueueBufferRef[16] audioQueueBuffer;
AudioStreamPacketDescription[512] packetDescs;
unsigned int fillBufferIndex;
UInt32 packetBufferSize;
size_t bytesFilled;
size_t packetsFilled;
_Bool[16] inuse;
NSInteger buffersUsed;
NSDictionary *httpHeaders;
NSString *fileExtension;
AudioStreamPlayerState state;
AudioStreamPlayerState laststate;
AudioStreamPlayerStopReason stopReason;
AudioStreamPlayerErrorCode errorCode;
OSStatus err;
_Bool discontinuous;
pthread_mutex_t queueBuffersMutex;
pthread_cond_t queueBufferReadyCondition;
CFReadStreamRef stream;
NSNotificationCenter *notificationCenter;
UInt32 bitRate;
NSInteger dataOffset;
NSInteger fileLength;
NSInteger seekByteOffset;
UInt64 audioDataByteCount;
UInt64 processedPacketsCount;
UInt64 processedPacketsSizeTotal;
double seekTime;
BOOL seekWasRequested;
double requestedSeekTime;
double sampleRate;
double packetDuration;
double lastProgress;
BOOL pausedByInterruption;
}
An audio stream player based on Apple’s Core Audio Framework. More specifically, Audio Queue Services and AudioFileStream are used to handle audio buffers and audio streaming respectively.
@discussion: Special threading consideration- The audioQueue property should only ever be accessed inside a synchronized(self) block and only after checking that ![self isFinishing]
-
audio stream URL
Declaration
Objective-C
NSURL *url
-
Audio Queue object
Declaration
Objective-C
AudioQueueRef audioQueue
-
the audio file stream parser
Declaration
Objective-C
AudioFileStreamID audioFileStream
-
Audio file
Declaration
Objective-C
AudioFileID audioFile
-
description of the audio
Declaration
Objective-C
AudioStreamBasicDescription asbd
-
the thread where the download and audio file stream parsing occurs
Declaration
Objective-C
NSThread *internalThread
-
audio queue buffers
Declaration
Objective-C
AudioQueueBufferRef audioQueueBuffer[16]
-
packet descriptions for enqueuing audio
Declaration
Objective-C
AudioStreamPacketDescription packetDescs[512]
-
the index of the audioQueueBuffer that is being filled
Declaration
Objective-C
unsigned int fillBufferIndex
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
how many bytes have been filled
Declaration
Objective-C
size_t bytesFilled
-
how many packets have been filled
Declaration
Objective-C
size_t packetsFilled
-
flags to indicate that a buffer is still in use
Declaration
Objective-C
_Bool inuse[16]
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
flag to indicate middle of the stream
Declaration
Objective-C
_Bool discontinuous
-
a mutex to protect the inuse flags
Declaration
Objective-C
pthread_mutex_t queueBuffersMutex
-
a condition varable for handling the inuse flags
Declaration
Objective-C
pthread_cond_t queueBufferReadyCondition
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Bits per second in the file
Declaration
Objective-C
UInt32 bitRate
-
Offset of the first audio packet in the stream
Declaration
Objective-C
NSInteger dataOffset
-
Length of the file in bytes
Declaration
Objective-C
NSInteger fileLength
-
Seek offset within the file in bytes
Declaration
Objective-C
NSInteger seekByteOffset
-
Used when the actual number of audio bytes in the file is known (more accurate than assuming the whole file is audio)
Declaration
Objective-C
UInt64 audioDataByteCount
-
number of packets accumulated for bitrate estimation
Declaration
Objective-C
UInt64 processedPacketsCount
-
byte size of accumulated estimation packets
Declaration
Objective-C
UInt64 processedPacketsSizeTotal
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
- Sample rate of the file (used to compare with samples played by the queue for current playback time)
Declaration
Objective-C
double sampleRate
-
sample rate times frames per packet
Declaration
Objective-C
double packetDuration
-
last calculated progress point
Declaration
Objective-C
double lastProgress
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Undocumented
Declaration
Objective-C
@interface AudioStreamPlayer : NSObject { NSURL *url; AudioQueueRef audioQueue; AudioFileStreamID audioFileStream; AudioFileID audioFile; AudioStreamBasicDescription asbd; NSThread *internalThread; AudioQueueBufferRef[16] audioQueueBuffer; AudioStreamPacketDescription[512] packetDescs; unsigned int fillBufferIndex; UInt32 packetBufferSize; size_t bytesFilled; size_t packetsFilled; _Bool[16] inuse; NSInteger buffersUsed; NSDictionary *httpHeaders; NSString *fileExtension; AudioStreamPlayerState state; AudioStreamPlayerState laststate; AudioStreamPlayerStopReason stopReason; AudioStreamPlayerErrorCode errorCode; OSStatus err; _Bool discontinuous; pthread_mutex_t queueBuffersMutex; pthread_cond_t queueBufferReadyCondition; CFReadStreamRef stream; NSNotificationCenter *notificationCenter; UInt32 bitRate; NSInteger dataOffset; NSInteger fileLength; NSInteger seekByteOffset; UInt64 audioDataByteCount; UInt64 processedPacketsCount; UInt64 processedPacketsSizeTotal; double seekTime; BOOL seekWasRequested; double requestedSeekTime; double sampleRate; double packetDuration; double lastProgress; BOOL pausedByInterruption; }
-
Error code after AudioStreamPlayer internal error
Declaration
Objective-C
@property (assign, readwrite, atomic) AudioStreamPlayerErrorCode errorCode;
Swift
var errorCode: AudioStreamPlayerErrorCode { get set }
-
AudioStreamPlayer’s current state
Declaration
Objective-C
@property (readonly, atomic) AudioStreamPlayerState state;
Swift
var state: AudioStreamPlayerState { get }
-
AudioStreamPlayer current playback time
Declaration
Objective-C
@property (readonly, atomic) double currentTime;
Swift
var currentTime: Double { get }
-
The duration of available audio in seconds. Calculated from the bitRate and fileLength.
Declaration
Objective-C
@property (readonly, atomic) double duration;
Swift
var duration: Double { get }
-
The audio stream’s bit rate, if known.
Declaration
Objective-C
@property (assign, readwrite, atomic) UInt32 bitRate;
Swift
var bitRate: UInt32 { get set }
-
HTTP headers from received audio stream messages. Includes the mime type.
Declaration
Objective-C
@property (readonly, atomic) NSDictionary *httpHeaders;
Swift
var httpHeaders: [AnyHashable : Any]! { get }
-
File extension for audio file stream
Declaration
Objective-C
@property (readwrite, copy, atomic) NSString *fileExtension;
Swift
var fileExtension: String! { get set }
-
to control whether the alert is displayed in failWithErrorCode
Declaration
Objective-C
@property (assign, readwrite, nonatomic) BOOL shouldDisplayAlertOnError;
Swift
var shouldDisplayAlertOnError: Bool { get set }
-
Initialiser
Parameters
aURL
audio stream internet address
Return Value
initialised instance.
-
Creates an AudioStreamPlayer instance with an NSURL instance representing the HTTP address of the audio stream. - parameter: url The NSURL instance representing the internet address of the audio stream. - returns: The newly created AudioStreamPlayer instance
Declaration
Objective-C
+ (instancetype)audioStreamPlayerWithURL:(NSURL *)url;
Parameters
url
The NSURL instance representing the internet address of the audio stream.
Return Value
The newly created AudioStreamPlayer instance
-
Start audio stream playback
Declaration
Objective-C
- (void)start;
Swift
func start()
-
Stops audio stream playback
Declaration
Objective-C
- (void)stop;
Swift
func stop()
-
Pauses audio stream playback
Declaration
Objective-C
- (void)pause;
Swift
func pause()
-
Skips audio samples to move playhead to new position.
Declaration
Objective-C
- (void)seekToTime:(NSTimeInterval)newSeekTime;
Swift
func seek(toTime newSeekTime: TimeInterval)
Parameters
newSeekTime
new playhead position in seconds (and fractions of a second)
-
Playing status check
Declaration
Objective-C
- (BOOL)isPlaying;
Swift
func isPlaying() -> Bool
Return Value
true is player is playing audio stream
-
Paused status check
Declaration
Objective-C
- (BOOL)isPaused;
Swift
func isPaused() -> Bool
Return Value
true is player is paused
-
Check if audio player is waiting for audio samples in the stream
Declaration
Objective-C
- (BOOL)isWaiting;
Swift
func isWaiting() -> Bool
Return Value
YES if in AS_WAITING_FOR_DATA state
-
Check if audio player is initalised but not doing anything
Declaration
Objective-C
- (BOOL)isIdle;
Swift
func isIdle() -> Bool
Return Value
YES if the AudioStream is in the AS_INITIALIZED state
-
return YES if streaming halted due to error (AS_STOPPING + AS_STOPPING_ERROR)
Declaration
Objective-C
- (BOOL)isAborted;
Swift
func isAborted() -> Bool
Return Value
YES if streaming halted due to error (AS_STOPPING + AS_STOPPING_ERROR)
-
Caclulates bitrate of the stream.
Declaration
Objective-C
- (double)calculatedBitRate;
Swift
func calculatedBitRate() -> Double
Return Value
returns the bit rate, if known. Uses packet duration times running bits per packet if available, otherwise it returns the nominal bitrate. Will return zero if no useful option available.