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

Transparent background of TTML caption not respected #2824

Closed
ErezNe opened this issue May 14, 2017 · 5 comments
Closed

Transparent background of TTML caption not respected #2824

ErezNe opened this issue May 14, 2017 · 5 comments
Assignees
Labels

Comments

@ErezNe
Copy link

ErezNe commented May 14, 2017

Hi
I have 2 issues related to playing Dash stream with TTML subtitle on Exoplayer ver 2.1 and 2.3

  1. Although the TTML file header is configuerd to show the subtitle on the bottom part of the screen the subtitles are always display on the top part of the screen ather than at the bottom of the screen.this issue is not repruduce on old Exoplayer like 1.7

2.The subtitles are always showen with black background although the TTML file header is configuerd to show the subtitle with transparent background .this issue is also repruduce on old Exoplayer like 1.7

for example I attach my TTML header file
Thx
Erez
ttml header example.txt

@marcbaechinger
Copy link
Contributor

Hi Erez!

Can you please provide us with a test stream which exhibits the problem?

From the issue template:

Link to test content

Provide a link to media that reproduces the issue. If you don't wish to post it
publicly, please submit the issue, then email the link to
dev.exoplayer@gmail.com including the issue number in the subject line.

@ojw28
Copy link
Contributor

ojw28 commented May 15, 2017

Positioning:
This isn't a regression. The reason the older release "works" is that it completely ignored the positioning information. It just so happens that the default we chose is similar to what you're specifying in the TTML file. In more recent releases we take into account positioning information but we're not handling tts:displayAlign properly, which is why the positioning is incorrect.

Color:
More investigation needed.

@ojw28 ojw28 self-assigned this May 15, 2017
ojw28 added a commit that referenced this issue May 23, 2017
Issue: #2824

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156781252
@ojw28
Copy link
Contributor

ojw28 commented May 23, 2017

Positioning is now fixed for this sample (as of the change ref'd above).

@ojw28 ojw28 changed the title TTML subtitle is not working well with DASH Transparent background of TTML caption not respected May 23, 2017
@ojw28
Copy link
Contributor

ojw28 commented May 23, 2017

Updated issue comment to refer to the remaining problem with the background color.

ojw28 added a commit that referenced this issue May 23, 2017
Issue: #2824

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156781252
@ojw28
Copy link
Contributor

ojw28 commented May 25, 2017

I think the background color issue is working as intended. The way captions are styled is quite complicated, because (a) various caption formats define embedded styling, and (b) for accessibility reasons devices are required to allow global configuration of subtitle styles. Unfortunately the two weren't really considered together.

In ExoPlayer, by default, we merge the embedded style and the device specified style when deciding how captions should be rendered. Background color is defined at multiple levels:

  • Window background (background of the rectangular region within which the caption is placed)
  • Text background (background that bounds the text more closely on a per-line basis)
  • Embedded background (background that spans only certain parts of the text, for example a single word)

In this case window background is explicitly transparent in the embedded style. Text background is undefined, and so is obtained from the device specified style. By default it's black, which is why you see a black background. You can fix this by overriding the device specified style. For example the following will result in the captions being rendered with transparent text background:

simpleExoPlayerView.getSubtitleView().setStyle(new CaptionStyleCompat(Color.WHITE,
    Color.TRANSPARENT, Color.TRANSPARENT, CaptionStyleCompat.EDGE_TYPE_NONE, Color.WHITE,
    null));

@ojw28 ojw28 closed this as completed May 25, 2017
@google google locked and limited conversation to collaborators Sep 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants