-
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
Implement source-first ordering in "selectSource" as an optional over… #2847
Conversation
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 0b7ca4129f4f3953d9697e11cfaf11745051ed9d (Please note that this is a fully automated comment.) |
0b7ca41
to
71bfad9
Compare
}; | ||
|
||
let foundSourceAndTech; | ||
let flipFn = (fn) => (a, b) => fn(b, a); |
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.
why not just flip
and finder
?
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 71bfad903a78fdec6f2b9e3c00fc3fb824122877 (Please note that this is a fully automated comment.) |
9a79e9e
to
8aec518
Compare
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 9a79e9eca6e279b92156639656b87ca42257fda6 (Please note that this is a fully automated comment.) |
Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED Commit: 8aec518ef57c217aed7078a8ebca358970386822 (Please note that this is a fully automated comment.) |
8aec518
to
423dd27
Compare
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 423dd27f6cf95424f505211974c5ae870011543f (Please note that this is a fully automated comment.) |
// Extend TechFaker to create a tech that plays the only mime-type that TechFaker | ||
// will not play | ||
import Tech from '../../src/js/tech/tech.js'; | ||
import TechFaker from './tech/tech-faker.js'; |
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 don't know if we were ever explicit about this but I thought the style-consensus among the @videojs/core-committers was for import
s to live at the top of the file only.
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.
They are required to be at the top of the file. Only reason it hasn't complained is because we're putting babel into loose
mode.
We probably should add some doc for the new option. |
fixture.innerHTML += html; | ||
var tag = document.getElementById('example_1'); | ||
|
||
var player = new Player(tag, { techOrder: ['techFaker', 'playsUnsupported'], sourceOrder: true }); |
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.
let
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.
Almost every other tests in that file is using var
seems like a silly thing to change for one test.
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.
We kind of skimped on the migration of tests to full es6.
However, new code should definitely be with lets and what not.
Hm... I'm not sure we really have a place to document these options. |
Probably best place to document the option, besides the function's jsdoc might be in another section on this page: https://github.com/videojs/docs/blob/master/docs/guides/options.html |
@gkatsev Hmm. I added documentation to the tech.md guide since it is there where we mention techOrder. |
@rcrooks do we use the |
Yeah, I guess that location is fine. Now we need to figure out whether it should be in this repo or in the docs repo. Also, the jsdoc for the function should be updated. |
|
||
let foundSourceAndTech; | ||
let flip = (fn) => (a, b) => fn(b, a); | ||
let finder = (techArr, source) => { |
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.
if you want to be fancy:
let finder = ([techName, tech], source) => {
if (tech.canPlaySource(source)) {
return {source: source, tech: techName};
}
};
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.
Let's be fancy.
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: a1de5ca4d779ddfc7b0a27cda1052d555e2a1153 (Please note that this is a fully automated comment.) |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: c37f28b06029e8dcc42421e45ab4552dbab4f4ab (Please note that this is a fully automated comment.) |
let techs = | ||
this.options_.techOrder | ||
.map(toTitleCase) | ||
.map((techName) => { |
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.
// `Component.getComponent(...)` is for support of old behavior of techs
// being registered as components.
// Remove once that deprecated behavior is removed.
.map((techName) => [techName, Tech.getTech(techName) || Component.getCompnent(techName)])
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 don't like putting that much distance between chained property accesses. The reason the comment is inside the function in the first place is that it doesn't "break the chain" and indentation makes things even more clear.
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'm ok either way. If we update getTech
to automatically try calling getComponent
, then, we could probably just remove the comment altogether and have the nice oneliner here.
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: aed2ad0174b0b9158ddfacb5182777836af1c9ae (Please note that this is a fully automated comment.) |
|
||
With a player setup as follows: | ||
|
||
<video data-setup='{"techOrder": ["html5", "flash"]}, "sourceOrder": true'> |
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.
sourceOrder
should be moved to the data-setup
json.
Small comment on the docs. |
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 82df17e41cea6d94b160c0ff6624dd9a5d712b9a (Please note that this is a fully automated comment.) |
…ride to the currently implemented default "tech-first" ordering Video.js currently uses a tech-first slection algorithm (ie. find the first source that can be decoded by the first tech. if none, try the next tech and repeat.) but the video element does something more like source-first. This commit implements the semantics of an optional source-first selection system in video.js
82df17e
to
4aef350
Compare
Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED Commit: 4aef350 (Please note that this is a fully automated comment.) |
* 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 ...
…ride to the currently implemented default "tech-first" ordering
Video.js currently uses a tech-first slection algorithm (ie. find the first source that can be decoded by the first tech. if none, try the next tech and repeat.) but the video element does something more like source-first. This commit implements the semantics of an optional source-first selection system in video.js