Alexa Auto SDK  4.3
Classes | Public Types | Public Member Functions | List of all members
aace::alexa::LocalMediaSource Class Referenceabstract

Classes

class  LocalMediaSourceState
 
class  PlaybackState
 
class  SessionState
 

Public Types

enum  Source {
  Source::BLUETOOTH,
  Source::USB,
  Source::FM_RADIO,
  Source::AM_RADIO,
  Source::SATELLITE_RADIO,
  Source::LINE_IN,
  Source::COMPACT_DISC,
  Source::SIRIUS_XM,
  Source::DAB,
  Source::DEFAULT
}
 
enum  ContentSelector {
  ContentSelector::FREQUENCY,
  ContentSelector::CHANNEL,
  ContentSelector::PRESET
}
 
using PlayControlType = ExternalMediaAdapter::PlayControlType
 

Public Member Functions

virtual bool play (ContentSelector contentSelectorType, const std::string &payload)
 
virtual bool play (ContentSelector contentSelectorType, const std::string &payload, const std::string &sessionId)
 
virtual bool playControl (PlayControlType controlType)=0
 
virtual bool seek (std::chrono::milliseconds offset)=0
 
virtual bool adjustSeek (std::chrono::milliseconds deltaOffset)=0
 
virtual LocalMediaSourceState getState ()=0
 
virtual bool volumeChanged (float volume)=0
 
virtual bool mutedStateChanged (MutedState state)=0
 
Source getSource ()
 
void playerEvent (const std::string &eventName, const std::string &sessionId="")
 
void playerError (const std::string &errorName, long code, const std::string &description, bool fatal, const std::string &sessionId="")
 
void setFocus (bool focusAcquire=true)
 

Detailed Description

LocalMediaSource should be extended to use Alexa to switch among media sources local to the device. It supports bluetooth, USB, FM radio, AM radio, satellite radio, audio line, and CD player sources.

Deprecated:
This platform interface is deprecated. Use the Alexa Auto Services Bridge (AASB) message broker to publish and subscribe to AASB messages instead.
See also
aace::core::MessageBroker

Member Typedef Documentation

◆ PlayControlType

See also
ExternalMediaAdapterState

Member Enumeration Documentation

◆ Source

The Local Media Source type

Enumerator
BLUETOOTH 

bluetooth source

USB 

USB source

FM_RADIO 

FM radio source

AM_RADIO 

AM radio source

SATELLITE_RADIO 

satellite radio source

LINE_IN 

audio line source

COMPACT_DISC 

CD player source

SIRIUS_XM 

SIRIUS XM source

DAB 

DAB source

DEFAULT 

Default, unnamed media source

◆ ContentSelector

The Local Media Content Selection type for the play directive

Enumerator
FREQUENCY 

radio station selection

CHANNEL 

radio channel selection

PRESET 

preset selection

Member Function Documentation

◆ play() [1/2]

bool aace::alexa::LocalMediaSource::play ( ContentSelector  contentSelectorType,
const std::string &  payload 
)
virtual
Deprecated:
This function will be removed very soon. Use the new LocalMediaSource::play(ContentSelector contentSelectorType, const std::string& payload, const std::string& sessionId) instead Called when the user calls play with a content selection type
Parameters
[in]ContentSelectorContent selection type
[in]payloadContent selector payload (e.g. "1", "98.7 FM HD 1", "bbc radio four")
Returns
true if the platform implementation successfully handled the call, else false

◆ play() [2/2]

bool aace::alexa::LocalMediaSource::play ( ContentSelector  contentSelectorType,
const std::string &  payload,
const std::string &  sessionId 
)
virtual

Called when the user calls play with a content selection type

Parameters
[in]ContentSelectorContent selection type
[in]payloadContent selector payload (e.g. "1", "98.7 FM HD 1", "bbc radio four")
sessionIdA universally unique identifier (UUID) generated according to the RFC 4122 specification. Since Alexa is starting the session here, use this session Id for further events and errors.
Returns
true if the platform implementation successfully handled the call, else false

◆ playControl()

virtual bool aace::alexa::LocalMediaSource::playControl ( PlayControlType  controlType)
pure virtual

Occurs during playback control via voice interaction

Parameters
[in]controlTypePlayback control type being invoked
Returns
true if the platform implementation successfully handled the call, else false

◆ seek()

virtual bool aace::alexa::LocalMediaSource::seek ( std::chrono::milliseconds  offset)
pure virtual

Called when the user invokes media seek via speech.

Parameters
[in]offsetOffset position within media item, in milliseconds
Returns
true if the platform implementation successfully handled the call, else false

◆ adjustSeek()

virtual bool aace::alexa::LocalMediaSource::adjustSeek ( std::chrono::milliseconds  deltaOffset)
pure virtual

Called when the user invokes media seek adjustment via speech.

Parameters
[in]deltaOffsetChange in offset position within media item, in milliseconds
Returns
true if the platform implementation successfully handled the call, else false

◆ getState()

virtual LocalMediaSourceState aace::alexa::LocalMediaSource::getState ( )
pure virtual

Must provide the local media source , and information to maintain cloud sync

◆ volumeChanged()

virtual bool aace::alexa::LocalMediaSource::volumeChanged ( float  volume)
pure virtual

Notifies the platform implementation to set the volume of the output channel. The volume value should be scaled to fit the needs of the platform.

Parameters
[in]volumeThe volume to set on the output channel. volume is in the range [0,1].
Returns
true if the platform implementation successfully handled the call, else false

◆ mutedStateChanged()

virtual bool aace::alexa::LocalMediaSource::mutedStateChanged ( MutedState  state)
pure virtual

Notifies the platform implementation to apply a muted state has changed for the output channel

Parameters
[in]stateThe muted state to apply to the output channel. MutedState::MUTED when the output channel be muted, MutedState::UNMUTED when unmuted
Returns
true if the platform implementation successfully handled the call, else false

◆ getSource()

LocalMediaSource::Source aace::alexa::LocalMediaSource::getSource ( )

Return the source type the interface registered with

◆ playerEvent()

void aace::alexa::LocalMediaSource::playerEvent ( const std::string &  eventName,
const std::string &  sessionId = "" 
)

Should be called on a local media source player event. This will sync the context with AVS. Note: PlaybackSessionStarted and PlaybackSessionEnded handles the setFocus(true) and setFocus(false) internally. Do not call the deprecated setFocus method.

Parameters
[in]eventNameCanonical event name. Accepted values:
  • "PlaybackSessionStarted"
  • "PlaybackSessionEnded"
  • "PlaybackStarted"
  • "PlaybackStopped"
[in]sessionIdA universally unique identifier (UUID) generated according to the RFC 4122 specification. If playback session is started because of LocalMediaSource::play(ContentSelector contentSelectorType, const std::string& payload, const std::string& sessionId), use the same session Id. If the session is started due to any other reason, generate unique UUID and use it as a session ID until session is not ended.

◆ playerError()

void aace::alexa::LocalMediaSource::playerError ( const std::string &  errorName,
long  code,
const std::string &  description,
bool  fatal,
const std::string &  sessionId = "" 
)

Should be called on a local media source player error.

Parameters
[in]errorNameThe name of the error. Accepted values:
  • "INTERNAL_ERROR"
[in]codeThe error code
[in]descriptionThe detailed error description
[in]fataltrue if the error is fatal
[in]sessionIdA universally unique identifier (UUID) generated according to the RFC 4122 specification. If playback session is started because of LocalMediaSource::play(ContentSelector contentSelectorType, const std::string& payload, const std::string& sessionId), use the same session Id. If the session is started due to any other reason, generate unique UUID and use it as a session ID until session is not ended.

◆ setFocus()

void aace::alexa::LocalMediaSource::setFocus ( bool  focusAcquire = true)
Deprecated:
This function will be removed very soon. Use the LocalMediaSource::playerEvent(const std::string& eventName, const std::string& sessionId) instead with playbackSessionStarted and playbackSessionEnded events Should be called on local media source player events. This will switch the media focus to that context. Note: PlaybackSessionStarted and PlaybackSessionEnded handles the setFocus(true) and setFocus(false) internally. Do not call the deprecated setFocus method.

Alexa Auto SDK 4.3 - Copyright 2017-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0