Bug 136550 - Add TextTrack cueadd event
Summary: Add TextTrack cueadd event
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brendan Long
URL: https://www.w3.org/Bugs/Public/show_b...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-04 14:52 PDT by Brendan Long
Modified: 2023-10-14 07:53 PDT (History)
15 users (show)

See Also:


Attachments
Patch (19.66 KB, patch)
2014-09-04 14:52 PDT, Brendan Long
no flags Details | Formatted Diff | Diff
Patch (21.81 KB, patch)
2014-09-04 15:44 PDT, Brendan Long
no flags Details | Formatted Diff | Diff
Patch (17.88 KB, patch)
2014-09-23 09:26 PDT, Brendan Long
no flags Details | Formatted Diff | Diff
Patch (17.75 KB, patch)
2014-09-24 11:51 PDT, Brendan Long
no flags Details | Formatted Diff | Diff
Patch (20.60 KB, patch)
2014-09-24 12:01 PDT, Brendan Long
no flags Details | Formatted Diff | Diff
Patch (20.64 KB, patch)
2014-10-02 13:56 PDT, Brendan Long
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brendan Long 2014-09-04 14:52:28 PDT
Add TextTrack cueadd event
Comment 1 Brendan Long 2014-09-04 14:52:43 PDT
Created attachment 237650 [details]
Patch
Comment 2 Brendan Long 2014-09-04 15:03:10 PDT
This is an implementation based on my suggestion to the W3C:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25693

Right now, it's easy to look through cues for static .vtt files by waiting for the track to load, then listing them. Unfortunately, there's no reasonable way to do that for live cues, since they can be added at any point. You can see *some* of them when they fire with the cuechange event, but the cueadd event would let you see every cue, as soon as the media player is aware of them.
Comment 3 Brendan Long 2014-09-04 15:44:11 PDT
Created attachment 237651 [details]
Patch

Add changelog
Comment 4 Brendan Long 2014-09-22 13:21:46 PDT
Based on some feedback from Ian, I'm going to rewrite this to do one event per cue, which will incidentally make this patch much simpler.
Comment 5 Brendan Long 2014-09-23 09:26:27 PDT
Created attachment 238544 [details]
Patch
Comment 6 Brendan Long 2014-09-23 09:28:28 PDT
The new patch sends a CueEvent for each cue.

I'm not sure why the additions in JSDictionary are needed, and I can't figure out why toTextTrackCue() isn't in JSTextTrackCue.h.

Also the test times out if I use run-webkit-test, but it works fine if I run it manually:

TEST_RUNNER_TEST_PLUGIN_PATH= TEST_RUNNER_INJECTED_BUNDLE_FILENAME=WebKitBuild/Release/lib/libTestRunnerInjectedBundle.so WebKitBuild/Release/bin/WebKitTestRunner -v LayoutTests/media/track/text-track-oncueadd.html
Comment 7 Chris Dumez 2014-09-24 11:44:58 PDT
Comment on attachment 238544 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238544&action=review

> Source/WebCore/bindings/js/JSDictionary.cpp:189
> +    JSObject* object = asObject(value);

Wouldn't "result = JSTextTrackCue::toWrapped(value);" work?
Comment 8 Brendan Long 2014-09-24 11:51:03 PDT
Created attachment 238604 [details]
Patch

Using JSTextTrackCue::toWrapped now. I feel like I tried this before and it didn't work, but maybe it was something different.
Comment 9 Eric Carlson 2014-09-24 11:55:29 PDT
This event obviously isn't in the spec yet, is there a bug you can reference?
Comment 10 Brendan Long 2014-09-24 12:01:56 PDT
Created attachment 238605 [details]
Patch

Might as well try to fix the Windows version of this patch too..
Comment 11 Brendan Long 2014-09-24 12:17:45 PDT
(In reply to comment #9)
> This event obviously isn't in the spec yet, is there a bug you can reference?

Here it is:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25693
Comment 12 Eric Carlson 2014-09-24 12:52:00 PDT
Comment on attachment 238605 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238605&action=review

> Source/WebCore/ChangeLog:13
> +        * CMakeLists.txt:
> +        * DerivedSources.cpp:
> +        * bindings/js/JSDictionary.cpp:
> +        (WebCore::JSDictionary::convertValue):

I know it is a pain but I really prefer to have per-method (or per-file) comments in the ChangeLog. That makes it much easier for someone to understand what changed when reading the ChangeLog later.

> Source/WebCore/html/track/CueEvent.cpp:39
> +

Nit: don't need this extra blank line.

> LayoutTests/media/track/text-track-oncueadd.html:11
> +            var i = 0;

Nit: something like "cueNumber" would be clearer.
Comment 13 Brendan Long 2014-09-24 13:09:53 PDT
(In reply to comment #12)
> (From update of attachment 238605 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=238605&action=review
> 
> > Source/WebCore/ChangeLog:13
> > +        * CMakeLists.txt:
> > +        * DerivedSources.cpp:
> > +        * bindings/js/JSDictionary.cpp:
> > +        (WebCore::JSDictionary::convertValue):
> 
> I know it is a pain but I really prefer to have per-method (or per-file) comments in the ChangeLog. That makes it much easier for someone to understand what changed when reading the ChangeLog later.
> 
> > Source/WebCore/html/track/CueEvent.cpp:39
> > +
> 
> Nit: don't need this extra blank line.
> 
> > LayoutTests/media/track/text-track-oncueadd.html:11
> > +            var i = 0;
> 
> Nit: something like "cueNumber" would be clearer.

At the moment I'm trying to fix the Mac build for this. I'll incorporate these suggestions too.
Comment 14 Brendan Long 2014-10-02 13:56:21 PDT
Created attachment 239135 [details]
Patch
Comment 15 Brendan Long 2014-10-02 13:56:57 PDT
I'm having a lot of trouble getting Xcode builds working. This patch fixes everything else..
Comment 16 Brendan Long 2014-10-07 15:29:11 PDT
Eric - Do you think this event is useful, and if so, could you leave a comment on the W3C bug? I'm trying to prove that other people would like this.
Comment 17 Michael Catanzaro 2016-09-17 07:05:47 PDT
Comment on attachment 239135 [details]
Patch

Hi,

Apologies that your patch was not reviewed in a timely manner. Since it's now quite old, I am removing it from the review request queue. Please consider rebasing it on trunk and resubmitting.

To increase the chances of getting a review, consider using 'Tools/Scripts/webkit-patch upload --suggest-reviewers' to CC reviewers who might be interested in this bug.
Comment 18 Ahmad Saleem 2023-10-14 07:53:53 PDT
I can't find this here 'oncueadd':

https://html.spec.whatwg.org/multipage/media.html#cue-events

I checked all browsers:

Blink: TextTrack.idl (from source.chromium.org)
Gecko: TextTrack.idl (from searchfox.org)

and none have 'oncueadd'. Is it something still needed?