Open johnquinn-syn opened 3 years ago
Thanks for the request.
This looks like it might be slightly fiddly to implement, because ExoPlayer relies on styling spans to represent text styling inside Cue
objects. Unfortunately I can't see a platform-provided Span that supports outline styling as required by this feature.
We may need to add a custom span, and then manually add styling support to both WebViewSubtitleOutput
and CanvasSubtitleOutput
. We already have some of these custom spans, like RubySpan
.
I don't know when we'll have time to implemeting this ourselves - we would accept a high quality PR (but given the potential complexity mentioned above, it might be worth a prospective PR author sketching out their plans in a comment here before spending ages on the code so we can take a look).
It may be possible to simulate something approaching the desired presentation of text outline by using a small shadow, if there's adequate control over both the "hardness" of the shadow edge and the size of the shadow.
Thank you for investigating. I don't think we have the right expertise in this area to offer a fix. Is something that Nigel suggests doable?
My expertise is in the format and rendering requirements, not the specific implementation of ExoPlayer, so this may be way off, but I wonder if the shadow attributes in TextAppearanceSpan could be helpful.
Searching https://github.com/google/ExoPlayer/labels/enhancement and https://github.com/google/ExoPlayer/pulls I cannot see "outline" or "textOutline" mentioned.
TTML: Support for tts:textOutline
The https://exoplayer.dev/dash.html indicates support for ISO/IEC 14496-30 which in turn references https://www.w3.org/TR/ttml1/#style-attribute-textOutline. This is missing from TtmlDecoder parseStyleAttributes This is not supported and is very useful for high-lighting white subtitle text against a white background. (Our customers have complained)
Proposed solution
Implement support for https://www.w3.org/TR/2018/REC-ttml2-20181108/#style-attribute-textOutline as per the example in the document:
<style tts:textOutline="black 2px 0px"/>
Alternatives considered
Possible to over-ride the supplied subtites with CaptionStyleCompat but this is not suitable for all customers and it is best to respect the in-stream track.