Remove chaning ability and return promise for play()
This commit is contained in:
@ -295,15 +295,15 @@ element.addEventListener('ready', event => {
|
||||
|
||||
### Methods
|
||||
|
||||
An example method:
|
||||
Methods are not chainable. An example use of a method:
|
||||
|
||||
```javascript
|
||||
player.pause();
|
||||
player.play();
|
||||
```
|
||||
|
||||
| Method | Parameters | Description |
|
||||
| ------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||
| `play()` | - | Start playback. |
|
||||
| `play()`¹ | - | Start playback. |
|
||||
| `pause()` | - | Pause playback. |
|
||||
| `togglePlay(toggle)` | Boolean | Toggle playback, if no parameters are passed, it will toggle based on current status. |
|
||||
| `stop()` | - | Stop playback and reset to start. |
|
||||
@ -321,6 +321,8 @@ player.pause();
|
||||
| `supports(type)` | String | Check support for a mime type. |
|
||||
| `destroy()` | - | Destroy the instance and garbage collect any elements. |
|
||||
|
||||
1. `play()` will return a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) in _some_ browsers - WebKit and Mozilla [according to MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play) at time of writing.
|
||||
|
||||
### Getters and Setters
|
||||
|
||||
An example setter:
|
||||
|
Reference in New Issue
Block a user