Bug 175031

Summary: Old subtitle track is not deleted on 'src' attribute change event
Product: WebKit Reporter: Kirill Ovchinnikov <kirill.ovchinn>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, eric.carlson, jeremyj-wk, jer.noble, kirill.ovchinn, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: PC   
OS: Linux   
URL: https://rednoize.su/vtt-bug/index2.html
See Also: https://bugs.webkit.org/show_bug.cgi?id=175888
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Kirill Ovchinnikov
Reported 2017-08-01 09:40:26 PDT
Test page: https://rednoize.su/vtt-bug/index2.html 1. Start video playing and enable subtitles 2. Ensure that subtitle track is displayed (after 0:00:05 time position) 3. Click on "Next subtitle track" - track URL will be changed 4. You will see the old subtitle track and the new subtitle track in the same time. 5. Click on "Next subtitle track" one more time - the first track URL will be set again. 6. You will see one more clone of the first subtitle track I cannot find anything in the standards about it. As I can see, it is not prohibited to change 'src' attribute of the <track> element, and I logically suppose that on 'src' change event the old subtitle track should be deleted from the media and hidden from the screen. Tested on Midori 0.5.11. Chromium has the same problem, Firefox handles it well.
Attachments
Patch (3.79 KB, patch)
2017-08-04 02:38 PDT, Kirill Ovchinnikov
no flags
Patch (5.58 KB, patch)
2017-08-04 03:26 PDT, Kirill Ovchinnikov
no flags
Patch (7.15 KB, patch)
2017-08-09 06:53 PDT, Kirill Ovchinnikov
no flags
Kirill Ovchinnikov
Comment 1 2017-08-01 14:34:56 PDT
"Whenever a track element has its src attribute set, changed, or removed, the user agent must immediately empty the element's text track's text track list of cues. (This also causes the algorithm above to stop adding cues from the resource being obtained using the previously given URL, if any.)" https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks:text-track-list-of-cues-5
Radar WebKit Bug Importer
Comment 2 2017-08-01 17:25:57 PDT
Kirill Ovchinnikov
Comment 3 2017-08-04 02:38:03 PDT
Build Bot
Comment 4 2017-08-04 02:39:40 PDT
Attachment 317229 [details] did not pass style-queue: ERROR: Source/WebCore/ChangeLog:8: You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible. [changelog/nonewtests] [5] Total errors found: 1 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Kirill Ovchinnikov
Comment 5 2017-08-04 03:26:15 PDT
Eric Carlson
Comment 6 2017-08-04 10:07:10 PDT
Comment on attachment 317231 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317231&action=review Thank you for the patch! Marking r- for now because of the manual test. > ManualTests/media-track-src-change.html:18 > + <title>HTML5 Video Subtitle refresh bug test</title> > + <script> > + var vtts = ["https://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/track/captions-webvtt/captions-long.vtt", > + "https://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/track/captions-webvtt/captions.vtt"]; > + var actualSub = 0; > + document.addEventListener("DOMContentLoaded", function () { > + document.getElementById('vid').play(); > + document.getElementById('nextSub').addEventListener('click', function () { > + actualSub++; > + var subtitlesSrc = vtts[actualSub % vtts.length]; > + document.getElementById('vid').children[0].setAttribute("src", subtitlesSrc); > + }, false); > + }); Manual tests are not run frequently, so they are generally used for changes that can only be verified manually. This would be much better as a regular layout test, so it will be run automatically every time someone submits a patch. Because this bug results in a track with both the old and new cues, a test can check the number of cues before and after changing .src. Existing vtt tests are in LayoutTests/media/track/. Something like track-text-track-cue-list.html could be modified to test your change if you wish.
Kirill Ovchinnikov
Comment 7 2017-08-09 06:53:03 PDT
Kirill Ovchinnikov
Comment 8 2017-08-09 06:54:03 PDT
Thank you for your feedback and advice! I prepared a new patch with layout auto-test.
Eric Carlson
Comment 9 2017-08-09 09:12:39 PDT
Comment on attachment 317697 [details] Patch Thank you for the fix! If you don't have commit privileges, make the bug cq? and any committer can have the commit bot do it.
WebKit Commit Bot
Comment 10 2017-08-09 12:13:55 PDT
Comment on attachment 317697 [details] Patch Clearing flags on attachment: 317697 Committed r220472: <http://trac.webkit.org/changeset/220472>
WebKit Commit Bot
Comment 11 2017-08-09 12:13:56 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.