Bug 147951

Summary: captions tracks showing by default
Product: WebKit Reporter: Gary Katsevman <webkit>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: eric.carlson, jer.noble, jonlee, thefork, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Gary Katsevman 2015-08-12 13:35:47 PDT
Steps to reproduce the problem:
1. create a page with a video element
2. include a subtitle or caption track
3. make sure that the track from above is not marked as `default`

What is the expected behavior?
the subtitles or captions should show up only if they are marked as default, or if the user selects them.

What is the actual behavior?
If the user has not previously selected any captions, the first caption in the caption list shows up, regardless or whether that track is in the user locale's or whether the default audio is in the user's locale or not.

The spec (https://html.spec.whatwg.org/multipage/embedded-content.html#attr-track-default) for the `default` attribute on track elements implies that tracks should only be enabled if a user preference overrides the attribute or if the attribute is present.

I have a sample test page available here https://output.jsbin.com/kumefu/4.

Also, this was brought up as an issue against Chrome and was recently fixed. Relevant chromium bug: https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=captions%20showing&colspec=ID%20Pri%20M%20Week%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=388588
Comment 1 Matt Lauer 2016-12-27 07:28:04 PST
The default behavior of "Auto (Recommended)" is not a good default. The setting conflicts with video player wrappers which provide an additional caption engine. The native captions are then stuck on (by default) and impossible to disable since the native controls aren't available.

The prescriptive nature of the default setting doesn't integrate well with real-world video players and caption implementations. Firefox just started supporting webvtt captions on the native player very recently, and users with the Firefox ESR build still don't have native captions, so a player is still necessary to provide captions across common browsers. 

Also, the "closed" part of "closed captions" means users are to request captions during playback and the captions shouldn't be on by default (it's an unexpected behavior). That's how captions work on televisions and other browsers.
Comment 2 Radar WebKit Bug Importer 2017-01-02 18:39:21 PST
<rdar://problem/29843131>
Comment 3 Eric Carlson 2017-01-06 12:55:30 PST
(In reply to comment #1)
> The default behavior of "Auto (Recommended)" is not a good default. The
> setting conflicts with video player wrappers which provide an additional
> caption engine. The native captions are then stuck on (by default) and
> impossible to disable since the native controls aren't available.
> 
"Auto (Recommended)" is supposed to show a caption track only when 1) the language of the file's primary audio track doesn't match the user's preferred language, 2) a track in the user's preferred language is available, and 3) no other track is enabled.

> The prescriptive nature of the default setting doesn't integrate well with
> real-world video players and caption implementations. Firefox just started
> supporting webvtt captions on the native player very recently, and users
> with the Firefox ESR build still don't have native captions, so a player is
> still necessary to provide captions across common browsers. 
> 
> Also, the "closed" part of "closed captions" means users are to request
> captions during playback and the captions shouldn't be on by default (it's
> an unexpected behavior). That's how captions work on televisions and other
> browsers.

The current behavior is a bug, the captions in this file should not show automatically when "automatic" caption mode is enabled.
Comment 4 Eric Carlson 2017-01-06 12:58:42 PST
The bug here is that AVFoundation returns "und" (undefined) for the audio track language, and WebKit doesn't treat this the same as no language at all.