Reputation: 6475
I have a WKWebView with content that has an <audio>
element pointing to a standard audio stream running on a Shoutcast server that will not play. There are no errors or information in the JavaScript console and no errors in the debugger in Xcode.
Upvotes: 2
Views: 2609
Reputation: 41
I added this to the App Transport Security Settings plist and it solved the problem for me:
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
Upvotes: 4
Reputation: 1
If problem persist for some <audio>
, replace "touchstart click" event by "touchend click" in js
Check this link for more details
Upvotes: 0
Reputation: 6475
The problem turned out to be App Transport Security. This new security feature in iOS 9 was silently preventing the <audio>
element from connecting to the insecure audio stream. Allowing arbitrary loads by adding this to my info.plist
solved the problem:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Upvotes: 3