The manager to control the audio stream
The delegate describing when files are done playing or any errors that occur
@property (nonatomic, weak) id<SDLAudioStreamManagerDelegate> _Nullable delegate;
Whether or not we are currently playing audio
@property (nonatomic, readonly, getter=isPlaying) BOOL playing;
var isPlaying: Bool { get }
The queue of audio files that will be played in sequence
@property (nonatomic, copy, readonly) NSArray<SDLAudioFile *> *_Nonnull queue;
var queue: [SDLAudioFile] { get }
Init should only occur with dependencies. use initWithManager:
- (nonnull instancetype)init;
A failure
Create an audio stream manager with a reference to the parent stream manager.
Warning
For internal use
- (nonnull instancetype)initWithManager:
(nonnull id<SDLStreamingAudioManagerType>)streamManager;
The parent stream manager
The audio stream manager
Push a new file URL onto the queue after converting it into the correct PCM format for streaming binary data. Call playNextWhenReady
to start playing the next completed pushed file.
Note
This happens on a serial background thread and will provide an error callback using the delegate if the conversion fails.
- (void)pushWithFileURL:(nonnull NSURL *)fileURL;
func push(withFileURL fileURL: URL)
File URL to convert
Push a new audio buffer onto the queue. Call playNextWhenReady
to start playing the pushed audio buffer.
This data must be of the required PCM format. See SDLSystemCapabilityManager.pcmStreamCapability and SDLAudioPassThruCapability.h.
This is an example of a PCM format used by some head units:
There is generally only one channel to the data.
- (void)pushWithData:(nonnull NSData *)data;
func push(with data: Data)
The audio buffer to be pushed onto the queue
Play the next item in the queue. If an item is currently playing, it will continue playing and this item will begin playing after it is completed.
When complete, this will callback on the delegate.
- (void)playNextWhenReady;
func playNextWhenReady()
Stop playing the queue after the current item completes and clear the queue. If nothing is playing, the queue will be cleared.
- (void)stop;
func stop()