Bug 164557 - [Modern Media Controls] Media Controller: set status label according to media state
Summary: [Modern Media Controls] Media Controller: set status label according to media...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 10
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-11-09 12:27 PST by Antoine Quint
Modified: 2016-11-09 14:37 PST (History)
3 users (show)

See Also:


Attachments
Patch (14.97 KB, patch)
2016-11-09 12:54 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (14.84 KB, patch)
2016-11-09 14:04 PST, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2016-11-09 12:27:57 PST
Now that we have a way to display a custom status label in the media controls, we need to reflect it correctly based on the media loading and network state.
Comment 1 Radar WebKit Bug Importer 2016-11-09 12:34:54 PST
<rdar://problem/29184097>
Comment 2 Antoine Quint 2016-11-09 12:54:56 PST
Created attachment 294269 [details]
Patch
Comment 3 Dean Jackson 2016-11-09 12:56:42 PST
Comment on attachment 294269 [details]
Patch

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

> Source/WebCore/Modules/modern-media-controls/media/status-support.js:2
> +
> +/*

Blank line.

> Source/WebCore/Modules/modern-media-controls/media/status-support.js:46
> +        let statusText = "";

Might as well just assign directly to this.control.text

> Source/WebCore/Modules/modern-media-controls/media/status-support.js:52
> +            statusText = "Error";
> +        if (media.duration === Number.POSITIVE_INFINITY && media.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA)
> +            statusText = "Live Broadcast";
> +        if (media.readyState <= HTMLMediaElement.HAVE_NOTHING && media.networkState === HTMLMediaElement.NETWORK_LOADING)
> +            statusText = "Loading";

How are you going to localize these?
Comment 4 Antoine Quint 2016-11-09 12:57:59 PST
(In reply to comment #3)
> Comment on attachment 294269 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=294269&action=review
> 
> > Source/WebCore/Modules/modern-media-controls/media/status-support.js:2
> > +
> > +/*
> 
> Blank line.

Will remove when landing.

> > Source/WebCore/Modules/modern-media-controls/media/status-support.js:46
> > +        let statusText = "";
> 
> Might as well just assign directly to this.control.text

Sure.

> > Source/WebCore/Modules/modern-media-controls/media/status-support.js:52
> > +            statusText = "Error";
> > +        if (media.duration === Number.POSITIVE_INFINITY && media.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA)
> > +            statusText = "Live Broadcast";
> > +        if (media.readyState <= HTMLMediaElement.HAVE_NOTHING && media.networkState === HTMLMediaElement.NETWORK_LOADING)
> > +            statusText = "Loading";
> 
> How are you going to localize these?

The same way I'll localise all other strings, using the same technique we've used for previous controls.
Comment 5 Antoine Quint 2016-11-09 14:04:10 PST
Created attachment 294286 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2016-11-09 14:37:52 PST
Comment on attachment 294286 [details]
Patch for landing

Clearing flags on attachment: 294286

Committed r208491: <http://trac.webkit.org/changeset/208491>
Comment 7 WebKit Commit Bot 2016-11-09 14:37:56 PST
All reviewed patches have been landed.  Closing bug.