Skip to content
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

Closed
wants to merge 8 commits into from
Closed

Add Player#reset function. #2880

wants to merge 8 commits into from

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Dec 3, 2015

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

* @method reset
*/
reset() {
this.loadTech_('Html5', null);
Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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

  1. we would need to implement something for flash in this case and probably would need to modify the swf
  2. Setting a source should choose the appropriate tech after the reset
  3. 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an offline discussion we decided that using the first item in the techOrder is the best course of action as it matches what happens in videojs if you were to load it in a page without any sources.
See flash and html examples.

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. needs: LGTM Needs one or more additional approvals labels Dec 3, 2015
@gkatsev gkatsev mentioned this pull request Dec 3, 2015
7 tasks
el.removeAttribute('src');

if (typeof el.load === 'function') {
// wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)
Copy link
Member

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.

@gkatsev
Copy link
Member Author

gkatsev commented Dec 7, 2015

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.
@gkatsev
Copy link
Member Author

gkatsev commented Dec 7, 2015

Rebased.

@@ -86,6 +86,9 @@ class Html5 extends Tech {

this.triggerReady();
}
clearMedia() {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, leftover.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@dmlap
Copy link
Member

dmlap commented Dec 7, 2015

LGTM

@gkatsev gkatsev closed this in e78e26b Dec 7, 2015
@gkatsev gkatsev deleted the reset branch December 7, 2015 22:46
jgubman added a commit to jgubman/video.js that referenced this pull request Jan 27, 2016
* 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
  ...
@gkatsev gkatsev removed the needs: LGTM Needs one or more additional approvals label Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor This PR can be added to a minor release. It should not be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support src being an empty string
2 participants