Video cannot play in iOS 12.2 webview (WKWebView and UIWebView both)

Originator:gwynjudd
Number:rdar://50394324 Date Originated:2/05/2019
Status:OPEN Resolved:
Product:iOS+SDK Webkit Product Version:12.2
Classification: Reproducible:ALWAYS
 
Area:
WebKit

Summary:
HTML5 video control wil supported video type will not play when the user clicks the play button in iOS 12.2. 

In the safari console, we see this error:
>Unhandled Promise Rejection: NotAllowedError: The request is not allowed by >the user agent or the platform in the current context, possibly because the >user denied permission

Steps to Reproduce:


On an html page we have got a video control:
								<video height="240" width="360" controls>
									<source src="myvideo.m4v"> video not supported
								</video>

The video is a supported video type. The user clicks the play button and it does not play. In the safari console, we see the error above.

There is no javascript code controlled by us that is playing the video. It appears in the safari debugger that webkit is injecting some javascript that is calling `HTMLMedia​Element​.play()`, but it is not my code.

This happens whether UIWebView or WKWebView is being used.

Expected Results:
The video will play

Actual Results:
The video does not play, and the error message above appears.

Version/Build:
iOS 12.2

Configuration:
No special configuration.

If `mediaPlaybackRequiresUserAction` is set to YES on the webview, the video will play. I believe this is should not be required, because the video play button is hit by a user interaction.

Comments

Hey does anyone have any updates on this?

Do you know when it will be fixed?

EDIT:

This worked for me; added to plist.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSIncludesSubdomains</key>
    <true/>
    <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
    <true/>
</dict>
By jeffrey.haines at June 21, 2019, 5:49 p.m. (reply...)

Any update on this? or any workaround?

I added mediaPlaybackRequiresUserAction and with iOs 12.2 the video not being played :(

Thanks!


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!