Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

SDLAudioStreamManager Class Reference

Section Contents

Overview

Undocumented

delegate

The delegate describing when files are done playing or any errors that occur

Objective-C

@property (readwrite, nonatomic)
    id<SDLAudioStreamManagerDelegate> _Nullable delegate;

playing

Whether or not we are currently playing audio

Objective-C

@property (readonly, getter=isPlaying, assign, nonatomic) BOOL playing;

Swift

var isPlaying: Bool { get }

queue

The queue of audio files that will be played in sequence

Objective-C

@property (readonly, copy, nonatomic) NSArray<SDLAudioFile *> *_Nonnull queue;

Swift

var queue: [SDLAudioFile] { get }

-init

Init should only occur with dependencies. use initWithManager:

Objective-C

- (nonnull instancetype)init;

Return Value

A failure

-initWithManager:

Create an audio stream manager with a reference to the parent stream manager.

Warning

For internal use

Objective-C

- (nonnull instancetype)initWithManager:
    (nonnull id<SDLStreamingAudioManagerType>)streamManager;

Parameters

streamManager

The parent stream manager

Return Value

The audio stream manager

-pushWithFileURL:

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.

Objective-C

- (void)pushWithFileURL:(nonnull NSURL *)fileURL;

Swift

func push(withFileURL fileURL: URL)

Parameters

fileURL

File URL to convert

-pushWithData:

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:

  • audioType: PCM
  • samplingRate: 16kHZ
  • bitsPerSample: 16 bits

There is generally only one channel to the data.

Objective-C

- (void)pushWithData:(nonnull NSData *)data;

Swift

func push(with data: Data)

Parameters

data

The audio buffer to be pushed onto the queue

-playNextWhenReady

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.

Objective-C

- (void)playNextWhenReady;

Swift

func playNextWhenReady()

-stop

Stop playing the queue after the current item completes and clear the queue. If nothing is playing, the queue will be cleared.

Objective-C

- (void)stop;

Swift

func stop()
View on GitHub.com
Previous Section Next Section