Bug 214634

Summary: REGRESSION: Fullscreen HTML5 video subtitles/captions are shown twice
Product: WebKit Reporter: Simon <simonkawaji>
Component: MediaAssignee: Peng Liu <peng.liu6>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, peng.liu6, philipj, robert.erneborg, sergio, simon.fraser, smorosow.dev, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: iPhone / iPad   
OS: iOS 13   
Attachments:
Description Flags
Patch
eric.carlson: review+
Revise the patch based on Eric's comment none

Description Simon 2020-07-22 03:12:11 PDT
When an HTML5 video is played with subtitles/captions in fullscreen, the previous subtitles will shown an additional time for a fraction of a second when the text is changed to the next one. The issue is a bit difficult to describe but you can take a look at the following examples to get a better understanding of the problem.

* Two examples that have the issue:
https://www.iandevlin.com/html5test/webvtt/html5-video-webvtt-sample.html
https://codepen.io/JediLin/full/jpzgpv

* How to recreate the bug:
Try one of these links and fullscreen the video and enable subtitles. 
The bug will occur on fullscreen but not on windowed/in-page mode.

I am using an 5th generation iPad with iOS version 13.6, Safari version 13.1
Comment 1 Radar WebKit Bug Importer 2020-07-23 17:43:28 PDT
<rdar://problem/66023355>
Comment 2 Peng Liu 2020-07-23 17:49:39 PDT
The issue is obvious with the first example video in my test.
Comment 3 Simon 2020-07-23 18:17:25 PDT
I can add that the issue did not occur on iOS 13.3.1 but does occur on iOS 13.6. And in iOS 13.4, Safari was updated from 13.0 to 13.1 which included some webkit updates: https://webkit.org/blog/10247/new-webkit-features-in-safari-13-1/
Comment 4 Robert Erneborg 2020-10-02 06:24:33 PDT
(In reply to Peng Liu from comment #2)
> The issue is obvious with the first example video in my test.

We are still affected by this. Is it likely that this issue will get picked up anytime soon?
Comment 5 Peng Liu 2021-01-23 19:52:13 PST
When I read the code, I noticed an issue that we set the "hidden" property of a text track representation layer to false before rendering the new subtitle. I will upload a patch to fix it.
Comment 6 Peng Liu 2021-02-01 13:37:10 PST
Created attachment 418917 [details]
Patch
Comment 7 Eric Carlson 2021-02-01 17:22:45 PST
Comment on attachment 418917 [details]
Patch

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

> Source/WebCore/html/shadow/MediaControlTextTrackContainerElement.cpp:302
> +    m_needsGenerateTextTrackRepresentation = true;

I know this isn't new to this change, but "m_needsToGenerateTextTrackRepresentation" would be a better name.
Comment 8 Peng Liu 2021-02-01 17:52:12 PST
Created attachment 418947 [details]
Revise the patch based on Eric's comment
Comment 9 Peng Liu 2021-02-01 17:52:37 PST
Comment on attachment 418917 [details]
Patch

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

>> Source/WebCore/html/shadow/MediaControlTextTrackContainerElement.cpp:302
>> +    m_needsGenerateTextTrackRepresentation = true;
> 
> I know this isn't new to this change, but "m_needsToGenerateTextTrackRepresentation" would be a better name.

Agree! fixed.
Comment 10 EWS 2021-02-01 21:18:59 PST
Committed r272190: <https://trac.webkit.org/changeset/272190>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418947 [details].