Remove chaning ability and return promise for play()

This commit is contained in:
Sam Potts
2017-12-20 20:47:02 +00:00
parent f3df7aba15
commit 9e0c406a4a
8 changed files with 34 additions and 48 deletions

View File

@ -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: