Cast & AirPlay buttons - show / hide when available #1048
Replies: 1 comment 1 reply
|
good question. there is a mechanism built-in Media Chrome for this. HTML attributes are set if the feature is not available. So adding a CSS block like below will hide the buttons if needed. Hope this helps! media-captions-button:not([mediasubtitleslist]),
media-captions-menu:not([mediasubtitleslist]),
media-captions-menu-button:not([mediasubtitleslist]),
media-audio-track-menu[mediaaudiotrackunavailable],
media-audio-track-menu-button[mediaaudiotrackunavailable],
media-rendition-menu[mediarenditionunavailable],
media-rendition-menu-button[mediarenditionunavailable],
media-volume-range[mediavolumeunavailable],
media-airplay-button[mediaairplayunavailable],
media-fullscreen-button[mediafullscreenunavailable],
media-cast-button[mediacastunavailable],
media-pip-button[mediapipunavailable] {
display: none;
} |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello, as you may remember I've been tasked with build a complex player based from your elements. So far it's going great. I like that you have a
<media-cast-button>as well as a<media-airplay-button>element.I was just wondering if there's a built-in API for showing / hiding the cast and airplay buttons based on the browser, or if it's one of those things you decided users should implement?
These are the elements I'm looking at:
POC: https://codepen.io/endymion1818/pen/eYqXaYw
Thanks
Ben
All reactions