Reference / @open-music-sdk/lib-preview-player / previewPlayer
Function: previewPlayer()
function previewPlayer<T>(options?): tPreviewPlayer<T>;Defined in: lib/lib-preview-player/src/player.ts:283
Makes a player of preview clips around one audio element. The element is listened to from then on, and that is all: it is given no clip, and nothing is played, until one of the player's functions is called. T is the kind of track it is fed, such as tSong, and is what state.track is typed as.
Sound starts only from play, next and previous, and from the end of a clip that was playing, which starts the next one. So the first sound follows a call the page made, which is what a browser wants a click behind.
Type Parameters
T
T extends tPreviewable = tPreviewable
Parameters
options?
The element to play through, and the hosts a clip may come from.
Returns
The player, frozen and inheriting nothing, with an empty queue and no track current.
Throws
TypeError if options is no plain object, if hosts is not a list of host names, if audio is no audio element, or if none was given where there is no Audio to make one with, as on a server.