-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Add Player#reset function. #2880
Conversation
* @method reset | ||
*/ | ||
reset() { | ||
this.loadTech_('Html5', null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch to the Html5 tech. Passing in null
for source
in loadTech_
would load the tech in "late init" mode if it needed to switch from another tech.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this switch to the first tech in the tech order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was debating that but
- we would need to implement something for flash in this case and probably would need to modify the swf
- Setting a source should choose the appropriate tech after the reset
- Html5 is basically the default tech.
Switching to Html5 and then resetting it is probably the easiest way to get to a nice base state where no sources are loaded and all readyStates are reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
el.removeAttribute('src'); | ||
|
||
if (typeof el.load === 'function') { | ||
// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be surprised if this was called frequently enough where de-opt was a performance issue but it's fine to leave this way, too.
Looks like I need to rebase this. |
Reset loads in the html5 tech and then resets the media element via a tech call. A techCall was used so that other techs could implement reset functionality as well and we could theoretically not switch to the Html5 tech on reset.
Rebased. |
@@ -86,6 +86,9 @@ class Html5 extends Tech { | |||
|
|||
this.triggerReady(); | |||
} | |||
clearMedia() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this leftover? Seems unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, leftover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
LGTM |
* upstream/stable: (479 commits) v5.4.4 @gkatsev switched to use custom vtt.js from npm. closes videojs#2905 v5.4.3 @gkatsev updated options customizer and github-release options. closes videojs#2903 v5.4.2 @gkatsev updated grunt-release config. closes videojs#2900 v5.4.1 @gkatsev added chg- and github- release for next releases. closes videojs#2899 v5.4.0 @gkatsev added ability to release next tag from master. closes videojs#2894 @gkatsev added nullcheck for cues in updateForTrack. Fixes videojs#2870. closes videojs#2896 @chemoish emulated HTMLTrackElement to enable track load events. closes videojs#2804 @gkatsev added a Player#reset method. Fixes videojs#2852. closes videojs#2880 @nick11703 changed multiline comments in sass with single-line comments. closes videojs#2827 @gkatsev added Player#tech. Fixes videojs#2617. closes videojs#2883 @misteroneill updated videojs-ie8 to 1.1.1. closes videojs#2869 v5.3.0 @imbcmdth added sourceOrder option for source-first ordering in selectSource. closes videojs#2847 @forbesjo updated formatTime to not go negative. closes videojs#2821 v5.2.4 ...
Reset loads in the html5 tech and then resets the media element via a
tech call.
A techCall was used so that other techs could implement reset
functionality as well and we could theoretically not switch to the Html5
tech on reset.
Fixes #2852