121 lines
4.0 KiB
JavaScript
121 lines
4.0 KiB
JavaScript
|
|
/**
|
||
|
|
* Enum of radio media types.
|
||
|
|
* @typedef MediaType
|
||
|
|
* @prop Music
|
||
|
|
* @prop Talk
|
||
|
|
* @prop Other
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @interface SongData
|
||
|
|
* @prop [mediaType] {MediaType}
|
||
|
|
* @prop [artist] {string}
|
||
|
|
* @prop [title] {string}
|
||
|
|
* @prop [artworkUrl] {string}
|
||
|
|
* @prop [length] {string}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @interface StationData
|
||
|
|
* @prop band {string}
|
||
|
|
* @prop callLetters {string}
|
||
|
|
* @prop description {string}
|
||
|
|
* @prop frequency {string}
|
||
|
|
* @prop logoUrl {string}
|
||
|
|
* @prop name {string}
|
||
|
|
* @prop website {string}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Enum of supported localities when searching for live stations
|
||
|
|
* @typedef Locality
|
||
|
|
* @prop Local
|
||
|
|
* @prop National
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Options provided to RadioPlayer#getStations
|
||
|
|
* @interface GetStationsOptions
|
||
|
|
* @prop [genreName] {string} The name of the genre for filteriing the station results
|
||
|
|
* @prop [locality] {Locality} Limit the results to national or local stations
|
||
|
|
* @prop [limit] {number} Limit the results to this amount
|
||
|
|
* @prop [preferredStation] {string} The call letters of the station preferred by the end-user, or the default station for the genre
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* This is an abstract base class, which cannot be instantiated directly;
|
||
|
|
* instead, use an implementation of this class, like IHeartPlayer
|
||
|
|
* @class RadioPlayer
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Initialize the RadioPlayer: implementations can override this, but must
|
||
|
|
* call super.init() to ensure this code runs
|
||
|
|
* @param {string} serialNumber Pass in the result from jibo.systemManager.getIdentity()
|
||
|
|
* @param {string} releaseVersion Pass in jibo.versions.release
|
||
|
|
* @param {string} country Pass in jibo.utils.Location.jiboHome.country;
|
||
|
|
* @param {number} lat Pass in jibo.utils.Location.jiboHome.lat
|
||
|
|
* @param {number} lng Pass in jibo.utils.Location.jiboHome.lng
|
||
|
|
* @param {ListenEvents} listenEvents Pass in jibo.gl.events
|
||
|
|
* @param {VolumePlugin} volumePlugin Pass in jibo.volume
|
||
|
|
* @return {Promise<void>} Resolves when all init steps are complete
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get a list of stations matching the options provided
|
||
|
|
* @method RadioPlayer#getStations
|
||
|
|
* @param {GetStationsOptions} options The search options to use
|
||
|
|
* @return {Promise<StationData[]>} Resolves to a list of stations matching the options provided
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Play the provided radio station; call letters may be retrieved from
|
||
|
|
* getStations() results. Abstract method must be implemented;
|
||
|
|
* implementations must call _streamHLS, _streamShoutcast, or _streamPLS
|
||
|
|
* @method RadioPlayer#play
|
||
|
|
* @param {string} callLetters The call letters of the station to play
|
||
|
|
* @return {Promise<void>} Resolves when the station actually starts streaming
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Replace a URL to artwork with one that will resize the artwork to the
|
||
|
|
* dimension provided. Implementations can override this; the default
|
||
|
|
* behavior simply returns the provided URL back, unaltered.
|
||
|
|
* @method RadioPlayer#resizeArtwork
|
||
|
|
* @param {string} url
|
||
|
|
* @param {number} width
|
||
|
|
* @return {string}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Pauses the current stream; not expected to be overridden
|
||
|
|
* @method RadioPlayer#pause
|
||
|
|
* @return {Promise<void>}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Begin playing the current stream, or resume the paused stream
|
||
|
|
* @method RadioPlayer#resume
|
||
|
|
* @return {Promise<void>}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Stop a stream, cancel related Promises and timers, remove related event
|
||
|
|
* listeners, and release all related resources for garbage collection.
|
||
|
|
* An implementation may override this, but must await super.stop().
|
||
|
|
* @method RadioPlayer#stop
|
||
|
|
* @return {Promise<void>}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Cancel all Promises and event listenrs and release all used memory
|
||
|
|
* @method RadioPlayer#destroy
|
||
|
|
* @return {void}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Stop any current stream, cancel Promises and event listeners, and
|
||
|
|
* release all memory used by the RadioPlayer for garbage collection
|
||
|
|
* @method RadioPlayer#stopAndDestroy
|
||
|
|
* @return {Promise<void>}
|
||
|
|
*/
|