Home Manual Reference Source Test
public class | source

TidalPlayer

Extends:

Player → TidalPlayer

This file adds support for the Tidal web player

by extending and overriding the classes Page, Playback, and Player. we can define how we'll interact with tidal's site

Method Summary

Public Methods
public

getArtists(): *

public

getCover(): *

public

getLength(): *

public
public

getTitle(): *

public

getUrl(): *

public

isPlaying(): *

Inherited Summary

From class Player
public

A URL with the media baseURI It's updated in refresh whenever metadata changes

public

element: HTMLMediaElement

The media element

public

The Host to communicate with

public

The Page that holds the player

public

Get the artists of the player

public

Get the cover of the player.

public

Get the id of the player

public

Length is expected in microseconds by host

public

Get the current time of the media

public

Get the playback rate

public

Get the site domain (host)

public

Get the title of the player.

public

Get the elements url

public

If media is muted return 0

public

Add listeners on this.element so we propagate all necessary events to the this.host

public

Check if element is visible to the user

public

Is the media looping?

public

Is the media muted?

public

Returns true if the media is paused.

public

Returns true if the media is not paused

public

Return true if the media is paused and current time is 0.

public
public

pause()

Pause media element

public

play(): *

Play media element

public

If media is playing then pause else play it

public

Update this.URL so getter read the correct data.

public

seek(offset: number)

seek by an offset to position

public

setLoop(loop: boolean)

Should media loop when it reaches the end.

public

setPosition(position: number)

Set the position of playback

public

setRate(rate: number)

Set the playback rate

public

setVolume(volume: number)

Set the volume of the media

public

stop()

Pause media and set position to 0

public

Toogle the fullscreen state of the media.

Public Methods

public getArtists(): * source

Get the artists of the player

Override:

Player#getArtists

Return:

*

public getCover(): * source

Get the cover of the player.

Using logo.clearbit.com API seems to work quite nicely. The other alternative is to get the logo from the page's favicon ({@link this.page.getIcon()})

Override:

Player#getCover

Return:

*

public getLength(): * source

Length is expected in microseconds by host

Override:

Player#getLength

Return:

*

public getPosition(): * source

Get the current time of the media

Override:

Player#getPosition

Return:

*

public getTitle(): * source

Get the title of the player. The page's title by default.

Override:

Player#getTitle

Return:

*

public getUrl(): * source

Get the elements url

Override:

Player#getUrl

Return:

*

public isPlaying(): * source

Returns true if the media is not paused

Override:

Player#isPlaying

Return:

*