Bug 74121 - Consider user's preferred language when choosing text tracks
Summary: Consider user's preferred language when choosing text tracks
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on: 76138
Blocks: 43668
  Show dependency treegraph
 
Reported: 2011-12-08 13:15 PST by Eric Carlson
Modified: 2012-02-01 21:12 PST (History)
3 users (show)

See Also:


Attachments
Proposed patch (38.09 KB, patch)
2012-02-01 14:24 PST, Eric Carlson
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2011-12-08 13:15:16 PST
The rules for sourcing out-of-band text tracks require access to the user's preferred language. For example:

   If the text track kind is subtitles or captions and the user has indicated an interest in having a track with this text track kind, text track language, and text track label enabled, and there is no other text track in the media element's list of text tracks with a text track kind of either subtitles or captions whose text track mode is showing

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#sourcing-out-of-band-text-tracks

On OS X, at least, the preference is an ordered list of languages.
Comment 1 Radar WebKit Bug Importer 2011-12-08 13:15:37 PST
<rdar://problem/10551005>
Comment 2 Eric Carlson 2012-02-01 14:24:15 PST
Created attachment 125015 [details]
Proposed patch
Comment 3 Alexey Proskuryakov 2012-02-01 14:31:28 PST
Comment on attachment 125015 [details]
Proposed patch

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

> Source/WebCore/html/HTMLMediaElement.cpp:2365
> +            // ...

?

> Source/WebCore/platform/Language.cpp:93
> +    if (lowercaseLanguageCode.length() >= 3 && lowercaseLanguageCode[2] == '_')
> +        lowercaseLanguageCode.replace(2, 1, "-");

Don't we want to use CoreFoundation to canonicalize? AppleLanguages can contains things like "English" on some systems.
Comment 4 Eric Carlson 2012-02-01 14:46:56 PST
(In reply to comment #3)
> (From update of attachment 125015 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=125015&action=review
> 
> > Source/WebCore/html/HTMLMediaElement.cpp:2365
> > +            // ...
> 
> ?

  I was tryingo indicate that the text is not the first thing after the section label. I can remove it if it is confusing.

> 
> > Source/WebCore/platform/Language.cpp:93
> > +    if (lowercaseLanguageCode.length() >= 3 && lowercaseLanguageCode[2] == '_')
> > +        lowercaseLanguageCode.replace(2, 1, "-");
> 
> Don't we want to use CoreFoundation to canonicalize? AppleLanguages can contains things like "English" on some systems.

Maybe. This is how we canonicalize language codes returned by AppleLanguages in createHTTPStyleLanguageCode (Languages.mm). Do you know if we have had an reports of problems with that code?

Thanks for the quick review!
Comment 5 Alexey Proskuryakov 2012-02-01 16:33:17 PST
> Maybe. This is how we canonicalize language codes returned by AppleLanguages in createHTTPStyleLanguageCode (Languages.mm). Do you know if we have had an reports of problems with that code?

No, none that I would remember.
Comment 6 Eric Carlson 2012-02-01 21:12:10 PST
(In reply to comment #5)
> > Maybe. This is how we canonicalize language codes returned by AppleLanguages in createHTTPStyleLanguageCode (Languages.mm). Do you know if we have had an reports of problems with that code?
> 
> No, none that I would remember.

OK, lets keep an eye out and problem show up I will add a platform specific version.
Comment 7 Eric Carlson 2012-02-01 21:12:25 PST
http://trac.webkit.org/changeset/106531