Closed Bug 1548731 Opened 7 months ago Closed 6 months ago

[webvtt] support `cuechange` event

Categories

(Core :: Audio/Video, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

(Blocks 2 open bugs, Regressed 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(3 files)

According to spec [1], oncuechange is one of the GlobalEventHandler. This event could be fired on Track element or TextTrack [2].

We would dispatch this event when we run the TimeMarchesOn algorithm. [3]

[1] https://html.spec.whatwg.org/multipage/webappapis.html#handler-oncuechange
[2] https://html.spec.whatwg.org/multipage/media.html#event-media-cuechange
[3] https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:event-media-cuechange

According to the spec [1], oncuechange is one of the GlobalEventHandler. This event could be fired on Track element or TextTrack [2].

We would dispatch this event when we run the TimeMarchesOn algorithm.

[1] https://html.spec.whatwg.org/multipage/webappapis.html#handler-oncuechange
[2] https://html.spec.whatwg.org/multipage/media.html#event-media-cuechange
[3] https://html.spec.whatwg.org/multipage/media.html#playing-the-media-resource:event-media-cuechange

Type: defect → enhancement
OS: Unspecified → All
Priority: -- → P2
Hardware: Unspecified → All
Version: unspecified → Trunk
Attachment #9062400 - Attachment description: Bug 1548731 - part2 : enable wpt 'track-cues-cuechange.html'. → Bug 1548731 - part2 : enable failed wpt items.
Blocks: webvtt-wpt

Now I'm investigating why track-mode.html and track-cues-cuechange.html will fail intermittently, will start a review after figuring out the reason.

This patch does two changes in order to test the correct behavior.

(1) Not to use time out function
Waiting for 0.4s by using timeout function doesn't mean the code will exactly be executed after 0.4s.
If we would like to specify the time when we should change track's mode, we should listen for video's timeupdate to get the correct result.

(2) Modify ending condition
As this test is going to turn the track to showing/hidden after video is playing after 0.4s, the second and the third cue would be showed correctly.

The second cue is from 0.3 to 0.7, so when we changed track mode in 0.4s, it would be regard as a active cue, and dispatch enter. When the cue is going to become inactive, the event exit would be dispatched.

Therefore, there would be total 4 times of the accumulation of enter and exit events, which means oncuechange would also be dispatched 4 times.

The track-cues-cuechange.html would only fail on the Win32 on try, I guess there might be some playback issue on Windows which causes the failure. I'm going to disable that test on Win32, but enable it on other platforms.

Component: DOM: Events → Audio/Video
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/073a5c5c2262
part1 : support 'cuechange' event. r=smaug
https://hg.mozilla.org/integration/autoland/rev/cea220a6b7dd
part2 : enable failed wpt items. r=smaug
https://hg.mozilla.org/integration/autoland/rev/304294b29dae
part3 : modify wpt 'track-mode.html'. r=smaug
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Regressions: 1550381
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16879 for changes under testing/web-platform/tests
Upstream PR merged
Summary: Support `cuechange` event → [webvtt] support `cuechange` event

We previously had this documenting as being implemented already in Firefox 31. I'm not sure why...

(In reply to Eric Shepherd [:sheppy] from comment #10)

We previously had this documenting as being implemented already in Firefox 31. I'm not sure why...

The MDN document is the cuechange event [1] for text track, but in this bug, what we implemented is the cuechange event for track element [2].

[1] https://developer.mozilla.org/en-US/docs/Web/API/TextTrack/cuechange_event
[2] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track

Oh! Gotcha! I missed that bit when doing a quick once-over of the bug. I'm on it then. :)

Documentation updates:

Duplicate of this bug: 1253905
Regressions: 1550442
You need to log in before you can comment on or make changes to this bug.