Dash-Industry-Forum / dash.js

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html
Other
5.08k stars 1.67k forks source link

Additional empty transparent region when playing STPP/TTML subtitles in Chrome #4429

Open tobbee opened 5 months ago

tobbee commented 5 months ago
Environment
Steps to reproduce
  1. Just play the URL
Observed behavior

Synchronised with the TTML subtitles, there is a wide transparent region with rounded corners at the bottom of the image. This shadow is not present when playing in Safari.

The region is similar to the subtitle region when playing subtitles using wvtt: https://livesim2.dashif.org/livesim2/timesubswvtt_de/testpic_2s/Manifest.mpd

Screenshot 2024-03-19 at 18 45 38

nigelmegitt commented 5 months ago

Reproduced in Chrome, bug not present in Firefox.

In Chrome, inspecting the elements, the unwanted area is not part of the DOM tree associated with the rendered TTML captions; it's not actually inspectable at all. I suspect the browser is attempting to render the VTTCue in the shadow DOM, that's intended to be used only for timing purposes to render the TTML. I'm not sure if there's a Chrome-specific way to prevent this: on my system (MacOS 14.3.1) the Chrome settings for captions takes the user to the System Preferences for Captions, but that shouldn't really be relevant - the browser shouldn't be attempting to render these VTTCues at all, so the question is why it is doing so and if it can be prevented.

tobbee commented 5 months ago

@nigelmegitt Do you think this is a bug in Chrome, that should be reported there?

nigelmegitt commented 5 months ago

@tobbee probably, yes.

dsilhavy commented 5 months ago

I think we discussed this before at some point and there was a CSS based solution to disable the background. I tried something like this for testing but didnt work:

::cue {
    background: blue;
}

@bbert Do you remember what we did to disable this grey background in Chrome?

In any case, as @nigelmegitt pointed out we are using TextTrack to handle the timing for the custom rendering. I would like to move to custom handling completely like we did here: https://reference.dashif.org/dash.js/nightly/samples/captioning/vttjs.html. This should also solve this issue then.

bbert commented 5 months ago

I think we discussed this before at some point and there was a CSS based solution to disable the background. I tried something like this for testing but didnt work:

::cue {
    background: blue;
}

@bbert Do you remember what we did to disable this grey background in Chrome?

In any case, as @nigelmegitt pointed out we are using TextTrack to handle the timing for the custom rendering. I would like to move to custom handling completely like we did here: https://reference.dashif.org/dash.js/nightly/samples/captioning/vttjs.html. This should also solve this issue then.

@jeffcunat I think you're the one who found this trick to disable the grey background, do you remember? you're still my css expert...

jeffcunat commented 5 months ago

Hi @bbert, as far as I remember it is some vendor specific pseudo class like those mentioned here : video::-webkit-media-text-track-region

https://chromium.googlesource.com/chromium/blink/+/72fef91ac1ef679207f51def8133b336a6f6588f/Source/core/css/mediaControls.css?autodive=0%2F%2F%2F#343

jeffcunat commented 5 months ago

I think we discussed this before at some point and there was a CSS based solution to disable the background. I tried something like this for testing but didnt work:

::cue {
    background: blue;
}

@bbert Do you remember what we did to disable this grey background in Chrome? In any case, as @nigelmegitt pointed out we are using TextTrack to handle the timing for the custom rendering. I would like to move to custom handling completely like we did here: https://reference.dashif.org/dash.js/nightly/samples/captioning/vttjs.html. This should also solve this issue then.

@jeffcunat I think you're the one who found this trick to disable the grey background, do you remember? you're still my css expert...

To see the actual pseudo elements that the browser uses you can activate the Developer Tools preference on Elements => Show user agent shadow DOM

dsilhavy commented 5 months ago

@jeffcunat Thanks for your input. I tried changing video::-webkit-media-text-track-display which seems to be the right element, however it was still showing this gray background. I don't consider this a dash.js issue, but it would be nice if we can document a CSS based solution for this in this ticket.