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

Issues with chapters #3447

Closed
cervengoc opened this issue Jul 20, 2016 · 4 comments
Closed

Issues with chapters #3447

cervengoc opened this issue Jul 20, 2016 · 4 comments

Comments

@cervengoc
Copy link
Contributor

cervengoc commented Jul 20, 2016

Hello guys, I had problems with chapters. I don't have time for the PR, but here are a list of issues which I've found and fixed locally.

  • ChaptersButton listens to load event only when cues == null. In latest Chrome I have an empty cues property, so it seems like several browsers handle it differently. IMO the best would be to always subscribe to the load event and issue an update. Also, it would be needed to unsubscribe from it when player is disposed; when track is removed; etc. As a quick fix I refined the related if condition to !chaptersTrack.cues || !chaptersTrack.cues.length.
  • ChaptersMenuItem should be set to selectable, otherwise it won't update it's selected style on cuechange.
  • Chapters menu should take the chapters track's label as menu title and fall back to "Chapters" if not provided.
  • This is just a refactoring: it seems like ChaptersButton's createItems is incorretct, and not even called (createMenu is used instead), so it should be removed.
  • There are several styling isssues with chapters: font is not Arial because it inherits VideoJS font, so menu items and title look ugly; menu items have strange padding, the text is not aligned to the middle vertically.

Please someone handle these in the next release.

@gkatsev
Copy link
Member

gkatsev commented Jul 25, 2016

Thanks for the issue. We'll get around to it when we case. A PR is always greatly appreciated.
Some comments about each item below:

ChaptersButton listens to load event only when cues == null

It probably makes sense to always listen to load. When this was implemented, cues was always null before it was loaded but it's possible that things have changed by now.

ChaptersMenuItem should be set to selectable

Not sure that making the ChaptersMenuItem selectable is correct. Because we don't update update the "selected" item depending on the player's current time, I don't think it really makes sense for them to be selectable. Would the selected item but just the previously clicked item?
There definitely should be some visual cue that you've which item you've clicked on, though.

Chapters menu should take the chapters track's label as menu title and fall back to "Chapters"

That makes sense as an enhancement.

it seems like ChaptersButton's createItems is incorrect

Yup, createMenu probably needs to be broken up and a large portion moved into createItems.

font is not Arial because it inherits VideoJS font

The font-family was recently updated.

menu items have strange padding

Not sure what these means.

text is not aligned to the middle vertically

It looks aligned to me, but very possible it isn't perfect. Vertical alignment is hard in CSS.

@cervengoc
Copy link
Contributor Author

cervengoc commented Jul 26, 2016

@gkatsev I'll be able to work on it in the next weeks sometime, but as I've never contributed here yet, it will take time to learn your workflow, testing strategy, etc. That's why I suggested that someone should make this relatively small changes instead of me.

About selectable of chapter menu item. The correct way of handling chapters menu includes the automatic updates of menu items based on player time. And the good news is that it is actually implemented, I don't have time to find the line in the code to reference, but you can search for it easily. So the only missing point in this is that the menu item is not set to selectable, so the updates are basically (visually) ineffective.

@chemoish
Copy link
Member

chemoish commented Sep 2, 2016

@cervengoc I chose to go with selectable (chemoish/videojs-chapter-thumbnails#20).

Looks like the outstanding PR also includes https://github.com/videojs/video.js/pull/3472/files#diff-9a53c3d0b5b8d51011b2ba56e434ea2cR24.

Have you ran into the issue with https://github.com/videojs/video.js/blob/master/src/js/menu/menu-item.js#L72?

this.controlText(', selected'); and this.controlText(' '); causes tooltips to popup where title attribute is supported.

Putting the controlText into the title attribute was added after I made that change. For menu items the "control text" is really the visible text, and I re-used the hidden, screen-reader accessible controlText for something that is really a "control state". But you're right, with the title change it doesn't really work any more.

@gkatsev Maybe we should handle? or create another ticket for this? If selectable is the right approach?

gkatsev pushed a commit that referenced this issue Nov 23, 2016
…3472)

* Refactored ChaptersButton, broke logic into several methods.
* Fixed the issues in #3447 about in some browsers tracks have an empty cues array instead of null. * Now we always subscribe to load event, and force an update. Also, track changes are handled, so chapters track can now be changed at runtime.
* Fixed the issue in #3447 about chapters menu items are not selectable. Now automatic update of the selected item based on player time works fine.
* Implemented the usage of the chapters track's label attribute as menu title, if it's present. If not, we fall back to the localized "Chapters" title.
* Refined the menu styling, so that vjs-menu-title telement won't get the hover effect, It would confuse users, because they might believe that the title item is a clickable item too.
@gkatsev
Copy link
Member

gkatsev commented Nov 23, 2016

The PR has finally been merged.

@gkatsev gkatsev closed this as completed Nov 23, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants