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

Possible to expose variables to style captions #1027

Closed
endymion1818 opened this issue Nov 12, 2024 · 3 comments
Closed

Possible to expose variables to style captions #1027

endymion1818 opened this issue Nov 12, 2024 · 3 comments

Comments

@endymion1818
Copy link

Hi, I've noticed that the player chrome covers the captions in your examples.

https://www.media-chrome.org/docs/en/examples/captions-menu

I've tried to change the position using the HTML ::cue selector on the mux-video element but I have so far been unable to do that.

https://developer.mozilla.org/en-US/docs/Web/CSS/::cue

Could you expose a few CSS variables so that styling the captions could be possible? Specifically one that would allow us to reposition the captions further up from the bottom (line-height seems to be a working candidate here out of the limited available properties).

Thanks

@endymion1818 endymion1818 changed the title Possible to style captions with CSS ::cue selector? Possible to expose variables to style captions Nov 12, 2024
@endymion1818
Copy link
Author

❌ Closing as this is needed in mux-player not media-chrome.

@luwes
Copy link
Contributor

luwes commented Nov 25, 2024

@endymion1818 this should be possible with these CSS vars:

      video::-webkit-media-text-track-container {
        transform: var(--media-webkit-text-track-transform);
        transition: var(--media-webkit-text-track-transition);
      }

https://github.com/muxinc/media-elements/blob/main/packages/custom-media-element/custom-media-element.js#L86-L89

note that Mux player already does transforms on these when the controls show / hide.
I believe there isn't a way to select shown / hidden controls in CSS only at the moment but you can change the transform fixed like this:
https://codesandbox.io/p/sandbox/mux-player-text-track-transform-pzslo0?file=%2Findex.html%3A27%2C1

@endymion1818
Copy link
Author

Ah great, thanks yeah that worked for us 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants