-
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
Revert 4.12.9 and fix the Html5 tech with sourceHandlers that use MSE #2271
Closed
Closed
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cb35a73
Revert commits 463ba4ea44cf4fcbe749ef9e99f1eadad139207d and 20b46b9fb…
986533c
The Html5 tech correctly returns source urls when the underlying sour…
df2753a
Make the IIFE follow the style of the others in the project
7158bc3
Be very specific and only override the default behavior for src and c…
6271029
Added comments and made some names less cryptic
6b5df52
Fix reversed logic in previous commit
921f2f6
Source must be saved after calling the original setSource or it is se…
02b5b88
Added test for Html5 tech's special blob-uri handling
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 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 |
---|---|---|
|
@@ -314,10 +314,20 @@ vjs.Html5.prototype.exitFullScreen = function(){ | |
this.el_.webkitExitFullScreen(); | ||
}; | ||
|
||
vjs.Html5.prototype.returnFakeIfBlobURI_ = function (realValue, fakeValue) { | ||
var blobURIRegExp = /^blob\:/i; | ||
|
||
if (realValue && blobURIRegExp.test(realValue)) { | ||
return fakeValue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should there be null checking here? |
||
} | ||
return realValue; | ||
}; | ||
|
||
vjs.Html5.prototype.src = function(src) { | ||
var realSrc = this.el_.src; | ||
|
||
if (src === undefined) { | ||
return this.el_.src; | ||
return this.returnFakeIfBlobURI_(realSrc, this.source_); | ||
} else { | ||
// Setting src through `src` instead of `setSrc` will be deprecated | ||
this.setSrc(src); | ||
|
@@ -330,11 +340,13 @@ vjs.Html5.prototype.setSrc = function(src) { | |
|
||
vjs.Html5.prototype.load = function(){ this.el_.load(); }; | ||
vjs.Html5.prototype.currentSrc = function(){ | ||
if (this.currentSource_) { | ||
return this.currentSource_.src; | ||
} else { | ||
return this.el_.currentSrc; | ||
var realSrc = this.el_.currentSrc; | ||
|
||
if (!this.currentSource_) { | ||
return realSrc; | ||
} | ||
|
||
return this.returnFakeIfBlobURI_(realSrc, this.currentSource_.src); | ||
}; | ||
|
||
vjs.Html5.prototype.poster = function(){ return this.el_.poster; }; | ||
|
@@ -470,6 +482,27 @@ vjs.Html5.isSupported = function(){ | |
// Add Source Handler pattern functions to this tech | ||
vjs.MediaTechController.withSourceHandlers(vjs.Html5); | ||
|
||
/* | ||
* Override the withSourceHandler mixin's methods with our own because | ||
* the HTML5 Media Element returns blob urls when utilizing MSE and we | ||
* want to still return proper source urls even when in that case | ||
*/ | ||
(function(){ | ||
var | ||
origSetSource = vjs.Html5.prototype.setSource, | ||
origDisposeSourceHandler = vjs.Html5.prototype.disposeSourceHandler; | ||
|
||
vjs.Html5.prototype.setSource = function (source) { | ||
this.source_ = source.src; | ||
return origSetSource.call(this, source); | ||
}; | ||
|
||
vjs.Html5.prototype.disposeSourceHandler = function () { | ||
this.source_ = undefined; | ||
return origDisposeSourceHandler.call(this); | ||
}; | ||
})(); | ||
|
||
/** | ||
* The default native source handler. | ||
* This simply passes the source to the video element. Nothing fancy. | ||
|
This file contains 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 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 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
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.
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.
Can you explain this with a comment?