Closed Bug 1548923 Opened 6 months ago Closed 5 months ago

[webvtt] update cue display immediately after adding or removing cue

Categories

(Core :: Audio/Video: Playback, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

According to the spec [1], we will run TimeMarchesOn everytime when we add or remove a cue.

However, we won't update the cue display correctly if the media hasn't start, the TimeMarchesOn will early return here [2]. It's not the spec said, we should update cue display no matter video starts or not.

[1]
https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:time-marches-on-2
https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:time-marches-on-3

[2] https://searchfox.org/mozilla-central/rev/b4e790d05f5a146d186c238bac5601a553581d23/dom/html/TextTrackManager.cpp#634

According to the spec [1], we will run TimeMarchesOn everytime when we add or remove a cue. However, the spec didn't mention that we need to abort the algorithm steps if media hasn't started.

We should complete the TimeMarchesOn in order to update cue display after adding or removing a cue, no matter video starts or not.

[1]
https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:time-marches-on-2
https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:time-marches-on-3

Summary: Update cue display immediately after adding or removing cue → [webvtt] update cue display immediately after adding or removing cue
Attachment #9062584 - Attachment description: Bug 1548923 - part1 : update cue display even if the video hasn't started. → Bug 1548923 - part1 : abort to run `TimeMarchesOn` on certain situations.
Attachment #9062584 - Attachment description: Bug 1548923 - part1 : abort to run `TimeMarchesOn` on certain situations. → Bug 1548923 - part1 : only abort 'TimeMarchesOn' algorithm on seeking.

According to the spec [1], whenever the media element's readyState is changed back to HAVE_NOTHING, we have to reset all cues' active flag and update cue display in order to hide them.

It also means that we should not set any cue's flag when media element's readyState is HAVE_NOTHING, so we should abort the TimeMarchesOn in this situation.

[1] https://html.spec.whatwg.org/multipage/media.html#text-track-cue-active-flag

Attachment #9062585 - Attachment description: Bug 1548923 - part2 : add test 'test_webvtt_update_display_after_adding_or_removing_cue.html'. → Bug 1548923 - part3 : add test 'test_webvtt_update_display_after_adding_or_removing_cue.html'.
Attachment #9062584 - Attachment description: Bug 1548923 - part1 : only abort 'TimeMarchesOn' algorithm on seeking. → Bug 1548923 - part1 : only abort 'TimeMarchesOn' algorithm during seeking.
Attachment #9062584 - Attachment description: Bug 1548923 - part1 : only abort 'TimeMarchesOn' algorithm during seeking. → Bug 1548923 - part1 : abort 'TimeMarchesOn' algorithm during seeking.

In patch2, whenever the media element's readyState is changed back to HAVE_NOTHING, we would reset all cues' active flag and update cue display in order to hide them.

It also means that we should not set any cue's flag when media element's readyState is HAVE_NOTHING, so we should abort the TimeMarchesOn in this situation.

Attachment #9063573 - Attachment description: Bug 1548923 - part3 : prevent run `TimeMarchesOn` before media has any data. → Bug 1548923 - part4 : prevent run `TimeMarchesOn` before media has any data.

To change code order in order to follow the spec's steps order.

Attachment #9063576 - Attachment description: Bug 1548923 - part5 : change the code order. → Bug 1548923 - part5 : run `TimeMarchesOn` by correct order
Attachment #9063576 - Attachment description: Bug 1548923 - part5 : run `TimeMarchesOn` by correct order → Bug 1548923 - part5 : run `TimeMarchesOn` in correct order
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/667010d35e34
part1 : abort 'TimeMarchesOn' algorithm during seeking. r=jya
https://hg.mozilla.org/integration/autoland/rev/894e0713977b
part2 : reset cues' active flag when media element's ready state becomes 'HAVE_NOTHING' r=jya
https://hg.mozilla.org/integration/autoland/rev/1a3bb9e678fe
part3 : add test 'test_webvtt_update_display_after_adding_or_removing_cue.html'. r=jya
https://hg.mozilla.org/integration/autoland/rev/c64974ef15b2
part4 : prevent run `TimeMarchesOn` before media has any data. r=jya
https://hg.mozilla.org/integration/autoland/rev/005917cd9f36
part5 : run `TimeMarchesOn` in correct order r=jya
Regressions: 1550585
You need to log in before you can comment on or make changes to this bug.