YouTubePlayer
Extends:
The metadata sent to the mpris host is defined by the Player implementation
For youtube we get:
- the song title from the html
- the artist from the uploader
- the cover image from the static resource of the thumbnail
Method Summary
Public Methods | ||
public |
getArtists(): * |
|
public |
If we couldn't figure out the video id (see getId) then the player's id will be the element's baseURI, if that's the case we won't be able to get the thumbnail. so call super |
|
public |
A youtube video can have 4 different baseURLs |
|
public |
getTitle(): * |
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 |
getArtists(): Array<string> 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 |
refresh() Update this.URL so getter read the correct data. |
|
public |
seek by an offset to position |
|
public |
Should media loop when it reaches the end. |
|
public |
setPosition(position: number) Set the position of playback |
|
public |
Set the playback rate |
|
public |
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 getCover(): string source
If we couldn't figure out the video id (see getId) then the player's id will be the element's baseURI, if that's the case we won't be able to get the thumbnail. so call super
Override:
Player#getCoverpublic getId(): string source
A youtube video can have 4 different baseURLs
- /watch?v=ID_OF_VIDEO - when watching the default way
- /embed/ID_OF_VIDEO - when it is embedded on a different site
- /user/nprmusic - when in a users page
- /channel/UCC6mthPyZTpbk-Klz9RMxMw - when in a channels page
In cases 3 and 4 we don't have a way to figure out it's video id so the player id will be the full URL
Override:
Player#getIdpublic getTitle(): * source
Get the title of the player. The page's title by default.
Override:
Player#getTitleReturn:
* |