Bug 160852

Summary: Change in behaviour of playsinline in iOS 10 breaks YouTube functionality
Product: WebKit Reporter: Tony Short <tony.short2>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: eric.carlson, jer.noble, jond, jonlee, mmaxfield
Priority: P2    
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: Other   

Description Tony Short 2016-08-15 09:06:21 PDT
Our iOS app presenting a YouTube video within a WKWebView is no longer playing inline on loading.  The video now starts in Full Screen and the whilst the user can manually make it inline, the previous behaviour was for it to start playing inline.

This changed sometime between iOS 10 beta 2 and beta 5, and this happens on a device running iOS 10 beta 5 (an iPhone 6), but works fine as before on an iOS simulator (launched from XCode 8 beta 5).

The official YouTube helper app, shows this incorrect behaviour: https://github.com/youtube/youtube-ios-player-helper

The problem may well lie in how the YouTube script creates their <video> element, and how they are using webkit-playsonline & playsonline.  Another developer has raised this with Google (https://code.google.com/p/gdata-issues/issues/detail?id=8487) and myself on SO (http://stackoverflow.com/questions/38879065/why-dont-youtube-videos-play-inline-in-ios-10-beta-5/38885359#38885359), but no response.  We appreciate it may be on YouTube to fix this, but with no quick response we're worried that iOS 10 will be released and it will have significant impact on the UI, and I imagine a lot of apps will be affected by this.  I am hoping this can be resolved by either the Webkit or the YouTube team.
Comment 1 Myles C. Maxfield 2016-08-18 15:16:19 PDT
playsinline is the future. webkit-playsinline is deprecated.
Comment 2 Myles C. Maxfield 2016-08-18 15:20:30 PDT
https://trac.webkit.org/changeset/203752/trunk/Source/WebCore/html/MediaElementSession.cpp is the change which changes the policy.
Comment 3 Myles C. Maxfield 2016-08-18 15:20:57 PDT
https://webkit.org/blog/6784/new-video-policies-for-ios/
Comment 4 Tony Short 2016-08-18 16:05:52 PDT
Thanks.  Do you have any contacts in YouTube you could let know about this?
Comment 5 Eric Carlson 2016-08-18 16:11:49 PDT
Yes, we will discuss this with them.
Comment 6 Tony Short 2016-08-26 03:04:10 PDT
Thank you - it appears to have just been resolved.