Skip to content

subtitles parser doesn't handle time codes that include more than 3 digits in the milliseconds field #1997

@warren-bank

Description

@warren-bank

Version

Media3 main branch

More version details

you ask: why would the milliseconds field ever contain more than 3 digits
I reply: it shouldn't, but for whatever reason.. captions on PBS do

example:

  • VTT for PBS News Hour
    • episode: 12/23/2024
    • notice that all time codes have 6 digits in the milliseconds field
      • ex: 00:00:00.000000 --> 00:00:00.100000
      • I didn't dig into the code to see how the parser is processing this field, but I can tell you that in ExoPlayer.. no subtitles show for a while.. and then (at about 7 minutes) a giant dump of text covers the screen
    • quick test:
      • I downloaded the file
      • opened it in a text editor
      • performed the following regex operation on its contents:
        • search: (\.\d{3})\d{3}
        • replace: $1
      • note: this effectively truncates the milliseconds field from 6 digits to 3 digits
      • loaded the resulting vtt file in ExoPlayer
      • issue fixed.. captions play as expected

note: I haven't yet tested their SRT captions; I suspect the same time code format. TBD..

Devices that reproduce the issue

OS: Android
app: ExoAirPlayer v3.7.0
lib: AndroidX Media3 v1.5.0

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

load captions from: VTT

Expected result

captions display at the correct time

Actual result

captions don't display at the correct time

Media

-or-

Bug Report

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions