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

clear out currentSource on loadstart #2957

Closed
wants to merge 1 commit into from

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Dec 29, 2015

Starting with v5.2.2 we've been returning the cached src for source handlers. This is important for techs that end up using MSE so that we return an the original source rather than the blob url that gets set.
However, there are cases when, in the html5 tech, the underlying video element could get a new video set, bypassing the videojs API. We want to actually pick up this change to return the new sources.

@@ -477,6 +477,11 @@ class Html5 extends Tech {
* @method setSrc
*/
setSrc(src) {
let loadstartlistener = () => this.currentSource_ = 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.

The main question: should we dispose the current source handler?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, loadstartlintener should probably be moved to a private prototype method so that removing it works correctly on subsequent calls to setSrc.

@gkatsev
Copy link
Member Author

gkatsev commented Dec 29, 2015

Opening it up now for discussion. This should get tests but I'll wait off till we decide the specific functionality.
@videojs/core-committers opinions? Thanks.

@gkatsev
Copy link
Member Author

gkatsev commented Dec 29, 2015

(Also, the direct issue that sprouted this has been worked around for now, so, it's not a huge hurry)

@gkatsev gkatsev added needs: discussion Needs a broader discussion needs: LGTM Needs one or more additional approvals patch This PR can be added to a patch release. labels Dec 29, 2015
@chemoish
Copy link
Member

I haven't been following, but is this currentSource similar to #2678?

@gkatsev
Copy link
Member Author

gkatsev commented Dec 29, 2015

@chemoish sort of, actually. The Source Handler interface in videojs (what videojs-contrib-hls uses) gives the source ({src, type}) obj to the source handler to work on. It'll then cache it locally for the life of that source handler. The issue is that we keep returning that cached value even when the underlying video src has been changed because it didn't go through the videojs API (we didn't know it changed).

@chemoish
Copy link
Member

I understand the error, but didn't quite follow if the existing currentSource_ implementation (#2833) makes #2678 obsolete.

#2678 doesn't handle anything other than attempting to store unmodified sources for MSE reasons.

(So regardless, the issue that this PR is addressing still must be addressed)

@gkatsev
Copy link
Member Author

gkatsev commented Dec 30, 2015

Ah, I see. No, it doesn't necessarily make it obsolete. #2833 made it so that currentSrc would now return the cached source in the case of MSE. It only returns the source url and not the type as well.
So, with MSE, and #2833 you would now get http://example.com/video.m3u8 instead of blob://example.com when calling player.currentSrc().
#2678 probably needs to get updated to use currentSource_. That feature could still be useful since it returns both the type and source of the video. currentSource_ is the source object (what you pass to player.src() that is given to Source Handlers.

@gkatsev gkatsev removed the needs: LGTM Needs one or more additional approvals label Feb 3, 2016
@gkatsev gkatsev closed this Mar 8, 2016
@gkatsev gkatsev deleted the update-html-src branch March 8, 2016 20:40
@gkatsev gkatsev restored the update-html-src branch March 8, 2016 20:41
@gkatsev gkatsev reopened this Apr 26, 2016
@gkatsev gkatsev closed this Apr 26, 2016
@gkatsev gkatsev deleted the update-html-src branch April 26, 2016 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: discussion Needs a broader discussion patch This PR can be added to a patch release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants