Bug 137180 - [iOS] Optimize media controls AirPlay discovery
Summary: [iOS] Optimize media controls AirPlay discovery
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-09-27 10:42 PDT by Eric Carlson
Modified: 2014-09-29 11:12 PDT (History)
8 users (show)

See Also:


Attachments
Proposed patch. (5.26 KB, patch)
2014-09-27 10:55 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2014-09-27 10:42:21 PDT
The iOS media controls register for AirPlay discovery events to know when to include a target picker in the UI. Putting the hardware into discovery mode uses more battery, so don't do it until we can display inline controls, and stop if the element fails to load.
Comment 1 Eric Carlson 2014-09-27 10:55:22 PDT
Created attachment 238780 [details]
Proposed patch.
Comment 2 Radar WebKit Bug Importer 2014-09-27 10:58:45 PDT
<rdar://problem/18479051>
Comment 3 Darin Adler 2014-09-28 17:26:12 PDT
Comment on attachment 238780 [details]
Proposed patch.

I’d like to understand more about why we always end up listening soon enough with this code. The trickiest bit of code here is the removeEventListeners case; subtle that it’s always OK to not listen there because setControlsType will always be called later.
Comment 4 Eric Carlson 2014-09-29 09:09:43 PDT
(In reply to comment #3)
> (From update of attachment 238780 [details])
> I’d like to understand more about why we always end up listening soon enough with this code. The trickiest bit of code here is the removeEventListeners case; subtle that it’s always OK to not listen there because setControlsType will always be called later.

This works because HTMLMediaElement fires an event every time an event listener is added. This means that if we register an event listener when we are about to display the inline controls, we will always get an event so we can configure the controls correctly.
Comment 5 WebKit Commit Bot 2014-09-29 11:12:22 PDT
Comment on attachment 238780 [details]
Proposed patch.

Clearing flags on attachment: 238780

Committed r174073: <http://trac.webkit.org/changeset/174073>
Comment 6 WebKit Commit Bot 2014-09-29 11:12:26 PDT
All reviewed patches have been landed.  Closing bug.