这是indexloc提供的服务,不要输入任何密码
Skip to content

WebvttParser creates duplicate CuesWithTiming when handling cues sharing same start/end timestamps #1177

@JunkFood02

Description

@JunkFood02

Version

Media3 1.3.0

More version details

media3-extractor

Devices that reproduce the issue

Android Studio

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Use WebvttParser.parse() to parse the vtt captions below:

private const val vttSample = """WEBVTT
Kind: captions
Language: en

00:00:00.000 --> 00:00:01.712
[MUSIC PLAYING]

00:00:02.533 --> 00:00:03.950
SPEAKER: As an
Android engineer, I

00:00:03.950 --> 00:00:06.350
have seen firsthand how
the ecosystem is growing--
"""
val cuesWithTimingList = buildList {
            WebvttParser().parse(
                vttSample.toByteArray(),
                SubtitleParser.OutputOptions.allCues()
            ) {
                add(it)
            }
        }

Expected result

The cuesWithTimingList contains 3 items or lines

Actual result

The list contains 4 items, see screenshot

image

Media

WEBVTT
Kind: captions
Language: en

00:00:00.000 --> 00:00:01.712
[MUSIC PLAYING]

00:00:02.533 --> 00:00:03.950
SPEAKER: As an
Android engineer, I

00:00:03.950 --> 00:00:06.350
have seen firsthand how
the ecosystem is growing--

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