Add more methods to Webamp

Replaces #660
This commit is contained in:
Jordan Eldredge 2019-03-24 21:51:52 -07:00
parent 92e54869e0
commit c4282817db
8 changed files with 67 additions and 5 deletions

View file

@ -219,6 +219,22 @@ Seek backward n seconds in the current track.
webamp.seekBackward(10);
```
### `seekToTime(seconds)`
Seek to a given time within the current track.
```JavaScript
webamp.seekToTime(15.5);
```
### `getMediaStatus()`
Get the current "playing" status. The return value is one of: `"PLAYING"`, `"STOPPED"`, or `"PAUSED"`.
```JavaScript
const isPlaying = webamp.getMediaStatus() === "PLAYING";
```
### `pause(): void`
Pause the current track.
@ -235,6 +251,14 @@ Play the current track.
webamp.play();
```
### `stop(): void`
Stop the currently playing audio. Equivilant to pressing the "stop" button.
```JavaScript
webamp.stop();
```
### `renderWhenReady(domNode: HTMLElement): Promise<void>`
Webamp will wait until it has fetched the skin and fully parsed it, and then render itself into a new DOM node at the end of the `<body>` tag.