shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.09k stars 1.33k forks source link

Bitmap Subtitle is displaying middle of the screen #2477

Closed kumarashu123 closed 4 years ago

kumarashu123 commented 4 years ago

Have you read the FAQ and checked for duplicate open issues? Yes

What version of Shaka Player are you using? 2.5.9

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from master? Yes

Are you using the demo app or your own custom app? Own custom app

If custom app, can you reproduce the issue using our demo app? Yes, able to reproduce issue in demo app

What browser and OS are you using? Chrome and Mac

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

What did you do?

Play a content which has bitmap based subtitle

What did you expect to happen? Subtile should not display middle of the screen

What actually happened?

Subtile is displaying middle of the screen. After investigation I found Below is sample for subtitle segment `

<region tts:extent="100.00% 6.76%" tts:origin="0% 86%" xml:id="region1"/>

`

In /lib/text/ttml_text_parser.js

parseCueRegion function percentage = TtmlTextParser.percentValues.exec(extent);

shaka.text.TtmlTextParser.percentValues_ = /^(\d{1,2}(?:.\d+)?|100)% (\d{1,2}(?:.\d+)?|100)%$/;

percentValues_ regex there is no support for decimal point for 100

image

joeyparrish commented 4 years ago

What are the manifest and license server URIs?

You skipped this question. Without a sample, we will be unable to reproduce your issue or work on a fix.

kumarashu123 commented 4 years ago

@joeyparrish Thanks for quick reply. I will share manifest url soon.

kumarashu123 commented 4 years ago

@joeyparrish Do you have an email where i can send the manifest url "

michellezhuogg commented 4 years ago

Hello @kumarashu123 , you can send it to shaka-player-issues@google.com .

kumarashu123 commented 4 years ago

Hi @joeyparrish, I will be mailing you the manifest URL.

Summarizing the issue,

This is the we are getting in the manifest:

And in ttml_textparser.js, we parse this with the following regex: shaka.text.TtmlTextParser.percentValues = /^(\d{1,2}(?:.\d+)?|100)% (\d{1,2}(?:.\d+)?|100)%$/;

As you can see above, this regex works fine for "100%", but not for "100.00%", as given in the example above.

Proposed fix: /^(\d{1,2}(?:.\d+)?|100(?:.0+)?)% (\d{1,2}(?:.\d+)?|100(?:.0+)?)%$/

joeyparrish commented 4 years ago

@kumarashu123, since you already have a fix, I've gone ahead and marked this as a bug and added the "help wanted" label. Please send a PR with your fix. Thanks so much!

kumarashu123 commented 4 years ago

@joeyparrish I have sent the manifest URL to shaka-player-issues@google.com.