-
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
Refactor TextTrackSettings (Phase 2) #3660
Conversation
This plugin makes browserify output numbers instead of the bundle paths to save some bytes in the output.
…d time range The control text element was being counted as the first buffered region but it didn't have the correct styling to be shown. Instead, we keep the buffered region elements in a separate element rather than relying on el.children to be correct.
…ideojs#3629) babel-preset-es2015-loose is deprecated as it's now available as an option to the es2015 preset.
* Disable HLS hack on Firefox for Android * Fix canPlayType patching tests * Add test to ensure that canPlayType is not patched in Firefox for Android * Fix assertion message in Firefox for Android test
Some of the code in the html5 tech is a bit redundant and can be written another way to reduce the file size. Also, we made sure that all functions can still be documented properly.
iOS still doesn't have native fullscreen API access. The video element uses the old webkit fullscreen events `webkitbeginfullscreen` and `webkitendfullscreen`. This makes it so both of those trigger `fullscreenchange` on the player always as opposed to only when `requestFullscreen` was called on the player.
* removing duplicate constructor docs fixing doc block (should not have ended in ?) * adding back event doc comments
id: 'captions-foreground-color-%s', | ||
label: 'Color', | ||
options: [ | ||
['#FFF', 'White'], |
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 should define the colors at the top once as a const, since we are using them in two places
id: 'captions-window-opacity-%s', | ||
label: 'Transparency', | ||
options: [ | ||
['0', 'Transparent'], |
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.
maybe define this as a const as well since it is used in two places
fontPercent: { | ||
selector: '.vjs-font-percent > select', | ||
id: 'captions-font-size-%s', | ||
label: 'Font Size', | ||
options: [ |
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 use an object for options in all of these?
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.
Easier to loop through? plus it matches other usecases above
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.
Also, ordering could be/is important.
'select', | ||
{id}, | ||
undefined, | ||
config.options.map(o => { |
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 options becomes an object this will have to change
{className: 'vjs-tracksettings-colors'}, | ||
undefined, | ||
[ | ||
createEl( |
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.
maybe create all of these elements outside of the main createEl
call so that this code is more understandable (as they will all have to have names, and you can add comments)
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.
Yeah, this one could be simpler.
{className: 'vjs-tracksettings-font'}, | ||
undefined, | ||
[ | ||
createEl( |
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.
same comment with this one as the createElColors_
although it isn't nearly as bad.
'div', | ||
{className: 'vjs-tracksettings'}, | ||
undefined, | ||
[this.createElColors_(), this.createElFont_(), this.createElControls_()]); |
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 );
go on the next line?
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 feel like the function argument format we've decided on was:
foo(
'a',
'b',
'c');
undefined, | ||
[this.createElColors_(), this.createElFont_(), this.createElControls_()]); | ||
|
||
const heading = createEl( |
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.
might just be opinion here but I would like it if these blocks looked something like this:
const heading = createEl('div', {
...
}, {
...
});
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 agree, personally, but this is another case of trying to be consistent is some way w/ function arguments.
* @method setDefaults | ||
*/ | ||
setDefaults() { | ||
Obj.each(selectConfigs, config => { |
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 think we typically wrap this in another set of parens in video.js. Obj.each((selectConfigs, config) =>
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're iterating over selectConfigs
, though. If anything, it'd be Obj.each(selectConfigs, (config) =>
.
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.
But it's apparent that this could be confusing, I'll add parens around config
. 👍
*/ | ||
createElControls_() { | ||
return createEl( | ||
'div', |
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.
same comment with this one as the createElColors_ although it isn't nearly as bad.
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.
Assuming the DOM output is the same, don't have any additional comments beyond what @brandonocasey already mentioned.
fontPercent: { | ||
selector: '.vjs-font-percent > select', | ||
id: 'captions-font-size-%s', | ||
label: 'Font Size', | ||
options: [ |
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.
Easier to loop through? plus it matches other usecases above
@@ -108,128 +200,6 @@ function setSelectedOption(el, value, parser) { | |||
} | |||
} | |||
|
|||
function captionOptionsMenuTemplate(uniqueId, dialogLabelId, dialogDescriptionId) { | |||
const template = ` |
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.
hurray
* @return {Element} | ||
* @function createEl | ||
*/ | ||
export function createEl(tagName = 'div', properties = {}, attributes = {}) { | ||
export function createEl(tagName = 'div', properties = {}, attributes = {}, content) { |
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.
This change would make it a minor, which is fine.
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.
But it does seem like a nice thing to have.
To be clear about the timeline/plan here, once this is approved, I'll close an re-open a new PR with both this one and #3570 together. |
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.
LGTM
['#FF0', 'Yellow'], | ||
['#F0F', 'Magenta'], | ||
['#0FF', 'Cyan'] | ||
COLOR_BLACK, |
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.
👍
@OwenEdwards would you be able to take a look? |
@@ -301,7 +301,7 @@ class TextTrackSettings extends Component { | |||
|
|||
return createEl('fieldset', { | |||
className: 'vjs-fg-color vjs-tracksetting' | |||
}, undefined, [legend, select, opacity]); | |||
}, undefined, [legend].concat(select, opacity)); |
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 is the other way broken?
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.
Because the select
is an array.
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.
Oh, I see now.
…eojs#3669) This updates our changelog automation to use conventinoal changelog. Ultimately, it will make it easier to merge PRs because it won't require the use of the contrib tool. It uses https://github.com/videojs/conventional-changelog-videojs/blob/master/convention.md
Also, replaced usage of assert.ok with assert.strictEqual where possible.
b70653f
to
981b64d
Compare
We can review and merge this into the already-approved branch from #3570, then open a new PR for the combination of the two.
Specific Changes proposed
This refactors the
TextTrackSettings
HTML blob intocreateEl
calls. Also, we extend thecreateEl
function to take a conventionalcontent
argument at the end, allowing nested calls tocreateEl
to build up a DOM structure.Requirements Checklist