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.
Created attachment 238780 [details] Proposed patch.
<rdar://problem/18479051>
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.
(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 on attachment 238780 [details] Proposed patch. Clearing flags on attachment: 238780 Committed r174073: <http://trac.webkit.org/changeset/174073>
All reviewed patches have been landed. Closing bug.