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

Basic descriptions track support #3098

Closed

Conversation

OwenEdwards
Copy link
Member

Adds support for descriptions text tracks, with a separate menu button on the control bar, and display using the same mechanism as captions and subtitles. To handle the situation where a descriptions and a captions or subtitles track could be enabled at the same time, the TextTrackDisplay prefers non-descriptions tracks over descriptions tracks, and the descriptions menu button disables itself if another track is enabled.

This PR could probably use some more Unit tests to check the priority model is TextTrackDisplay, and the self-disabling in descriptions-button. Also, the CSS styling applied to the button when it is disabled (just making it 0.5 opacity) may need more work.

I'd appreciate any feedback, suggestions, etc.

@OwenEdwards OwenEdwards added the a11y This item might affect the accessibility of the player label Feb 10, 2016
@@ -124,6 +124,10 @@ body.vjs-full-window {
// Hide disabled or unsupported controls.
.vjs-hidden { display: none !important; }

.vjs-disabled {
Copy link
Member

Choose a reason for hiding this comment

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

we can also change the cursor not-allowed

Copy link
Member Author

Choose a reason for hiding this comment

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

Wondering whether cursor: not-allowed is overkill, since a disabled button <button type="button" disabled>Click Me!</button> only shows cursor: default instead of cursor: pointer?

Copy link
Member

Choose a reason for hiding this comment

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

cursor: pointer seems fine as well.

@gkatsev
Copy link
Member

gkatsev commented Feb 10, 2016

Thanks @OwenEdwards, looks great.

@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 Feb 10, 2016
@OwenEdwards
Copy link
Member Author

@gkatsev would love some help in building out the unit tests, as I mention. Otherwise, I think this functionality is ready to go with these latest CSS updates.

@gkatsev gkatsev removed the needs: LGTM Needs one or more additional approvals label Feb 18, 2016
@gkatsev
Copy link
Member

gkatsev commented Mar 7, 2016

Sorry it's been a while. I should be able to help out with tests for this PR this week.

@gkatsev
Copy link
Member

gkatsev commented Mar 7, 2016

Also, looks like this needs to be rebase or updated from master.

@OwenEdwards
Copy link
Member Author

I'll take a look. If I do a rebase, then it'll have to become a new PR, right? Not a big deal, just wanted to know if I'm missing something.

@gkatsev
Copy link
Member

gkatsev commented Mar 8, 2016

You can force push if you want. Or you could merge.

Descriptions tracks are enabled by their own Control Bar menu button, and shown like other text tracks.
Display of a text track is marked as 'aria-live', so it will be read by a screen reader when it changes.
A descriptions track cannot be displayed at the same time as a Subtitles or Captions track; if either of
those tracks is enabled, then the Descriptions track is disabled, and the menu button is also disabled.
…k in the sandbox as descriptions.html.example.

Track examples are in docs/examples/elephantsdream.
Descriptions text track from @silviapfeiffer,
Captions from https://github.com/walsh9/videojs-transcript/tree/master/captions (converted from SRT to WebVTT)
Chapters text track created by @OwenEdwards.
@OwenEdwards OwenEdwards force-pushed the basic-descriptions-track-support branch from 2683ba3 to d5c79f3 Compare March 8, 2016 06:36
@OwenEdwards
Copy link
Member Author

Okay, this is rebased, simplified (fewer separate commits) and fixed to work with my other PR. Just needs some work on the tests, then it's ready to go.

@OwenEdwards OwenEdwards mentioned this pull request Mar 8, 2016
2 tasks
@chemoish
Copy link
Member

chemoish commented Mar 8, 2016

+1

*/
enable() {
this.removeClass('vjs-disabled');
this.el_.setAttribute('aria-disabled', 'false');
Copy link
Member

Choose a reason for hiding this comment

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

not necessary for this, but we're doing a lot of attribute setting, we probably should make a helper for components so you could just do this.setAttribute('aria-disabled', 'false');

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 That would be a good place to check that we're consistently passing 'false' or 'true' (strings) to ARIA attributes, rather than booleans, which I think causes problems.

@gkatsev
Copy link
Member

gkatsev commented Mar 10, 2016

Looks like the main missing unit test from this PR is one that checks that the descriptions button is disabled when caption or subtitle is enabled.
There are also a few unit tests missing for menu-button and clickable-component around enabling/disabling and pressing/unpressing.
I think the descriptions button test should be considered a blocker for this PR the others can always be added later.

@OwenEdwards
Copy link
Member Author

@gkatsev I think this covers the tests we talked about. Can you take a look and let me know?

expect(6);

var player, menuButton, el;
Copy link
Member

Choose a reason for hiding this comment

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

should be 3 lets.
We really need to update videojs to use vjsstandard already so I won't have to keep pointing these out myself :)

test('enabling a captions track should disable the descriptions menu button', function() {
expect(14);

var player = TestHelpers.makePlayer({
Copy link
Member

Choose a reason for hiding this comment

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

let

@gkatsev
Copy link
Member

gkatsev commented Mar 12, 2016

@OwenEdwards thanks! Looks good. Just some stylistic issues left :)

@OwenEdwards
Copy link
Member Author

@gkatsev think that does it!

@gkatsev
Copy link
Member

gkatsev commented Mar 12, 2016

Awesome. LGTM!

@OwenEdwards
Copy link
Member Author

@gkatsev realized that I needed to add some strings into en.json. Other than that, this is ready :-)

@gkatsev
Copy link
Member

gkatsev commented Mar 15, 2016

Cool!
Should hopefully get merged/released this week!

@OwenEdwards
Copy link
Member Author

👍

@chemoish
Copy link
Member

Kind of an aside, but does description track support work with data-setup='{}' configured?

#2689 (comment)

@OwenEdwards
Copy link
Member Author

@chemoish this change requires a data-setup='{ "html5" : { "nativeTextTracks" : false }}', because even browsers with native HTML5 track support don't support descriptions tracks. I haven't tested it with Opera, but it pasts tests on Firefox, Safari, Chrome and IE.

@gkatsev, I guess we ought to document this somewhere?

@gkatsev
Copy link
Member

gkatsev commented Mar 16, 2016

Yes, we need a text tracks guide doc.

Also, maybe we should just always subsume descriptions into emulated mode until browsers that implementing them? We can always do that as a follow-up PR.

@gkatsev gkatsev closed this in 41bc481 Mar 25, 2016
@OwenEdwards OwenEdwards deleted the basic-descriptions-track-support branch April 13, 2016 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y This item might affect the accessibility of the player confirmed 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.

3 participants