Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide background for ::cue pseudo-element on Safari?

Tags:

html

css

safari

I'm trying to hide captions on a video element:

captions without css

I'm using the following css:

video::cue { visibility: hidden; }

It works fine in Chrome, but on Safari it only hides the text, and still renders the caption background, like this:

captions with visibility: hidden

I tried adding background: none as well, but there's no change. How else can I hide the captions on Safari, besides modifying the text track list programmatically? Could this be a Safari bug?

like image 955
tacospice Avatar asked Nov 07 '22 14:11

tacospice


1 Answers

One solution is already mentioned here: Hiding a video text track with Safari. That is, if what you're trying to do is not display your captions directly in the video anyway, just use the track kind "metadata". In my case:

<track default label="English" kind="metadata" srclang="en" src="../static/captions/mexicocity_en.vtt" >
like image 180
Brian Peterson Avatar answered Nov 15 '22 05:11

Brian Peterson