-
Notifications
You must be signed in to change notification settings - Fork 137
Add 4 new API methods #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add 4 new API methods #1248
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
174ad86
New API methods
AxMannessiez d63a739
Update new API methodes
AxMannessiez a9b8e8d
Document new API methods
AxMannessiez 8239237
Integration tests for new API methods
AxMannessiez 070e6fd
Update isPaused method to better handle (re)loading states
AxMannessiez 64aad97
Organize docs, fix typo, and update reloadingMediaSource's payload
AxMannessiez 12f4aa4
Update isPaused doc and comments
AxMannessiez c918456
Update getLastStoredContentPosition description
AxMannessiez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
doc/api/Playback_Information/getLastStoredContentPosition.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # getLastStoredContentPosition | ||
|
|
||
| ## Description | ||
|
|
||
| Returns the last stored position of the last played content, in seconds. | ||
| Returns `undefined` if no content was previously loaded. | ||
|
|
||
| This method can be useful if you want to reload using `player.loadVideo()` and not | ||
| `player.reload()`, after an error for example. | ||
|
|
||
| It can also be used to retrieve the position where the player was at when the error arised. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```js | ||
| const lastStoredContentPosition = player.getLastStoredContentPosition(); | ||
| ``` | ||
|
|
||
| - **return value** `number|undefined` | ||
|
|
||
| #### Example | ||
|
|
||
| ```js | ||
| const lastStoredContentPosition = player.getLastStoredContentPosition(); | ||
|
|
||
| if (lastStoredContentPosition !== undefined) { | ||
| player.loadVideo({ | ||
| // ... | ||
| startAt: { | ||
| position: lastStoredContentPosition, | ||
| }, | ||
| }); | ||
| } | ||
| ``` | ||
|
|
||
|
|
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # isBuffering | ||
|
|
||
| ## Description | ||
|
|
||
| Returns `true` if the player is buffering. | ||
|
|
||
| The method relies solely on the state of the player, and is a shortcut for | ||
| `["BUFFERING", "SEEKING", "LOADING", "RELOADING"].includes(player.getPlayerState())`. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```js | ||
| const isBuffering = player.isBuffering(); | ||
| ``` | ||
|
|
||
| - **return value** `boolean` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # isContentLoaded | ||
|
|
||
| ## Description | ||
|
|
||
| Returns `true` if a content is loaded. If it is, the player is ready to play and you can | ||
| use APIs interacting with the current content such as `seekTo` or `setAudioTrack`. | ||
|
|
||
| The method relies solely on the state of the player, and is a shortcut for | ||
| `!(["LOADING", "RELOADING", "STOPPED"].includes(player.getPlayerState()))`. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```js | ||
| const isContentLoaded = player.isContentLoaded(); | ||
| ``` | ||
|
|
||
| - **return value** `boolean` |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # isPaused | ||
|
|
||
| ## Description | ||
|
|
||
| Returns the play/pause status of the player, that can be used for example to display a play/pause button: | ||
| - when the player is (re)loading, returns the scheduled play/pause condition | ||
| for when loading is over, | ||
| - in other states, returns the `<video>` element `.paused` value, | ||
| - if the player is disposed, returns `true`. | ||
|
|
||
|
|
||
| ## Syntax | ||
|
|
||
| ```js | ||
| const isPaused = player.isPaused(); | ||
| ``` | ||
|
|
||
| - **return value** `boolean` |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.