Can not play video mp4 in latest iOS 9.0.2


#1

Hello!
I have trouble to make my Ionic app play mp4 video in latest version of iOS 9.0.2 inside .
The video plays fine using Chrome/Safari, but once deployed to iOS, it can not play it and I can not see any errors. I can see only a Play icon. I have checked the config.xml and I have the following whilst access:

I have tested the following code :

 <ion-content>
        <video width="100%" controls="controls" preload="metadata" autoplay loop webkit-playsinline="webkit-playsinline" class="videoPlayer">
            <source ng-src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4"/>
        </video>
    </ion-content> 

I have not tested if this should work in older iOS, so I am not sure if this depends on new policy from Apple or something else.

I have tried to use “src” instead of “ng-src”, but same problem.


#2

I got the following error when I tested on older iOS:

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

I resolved it after days thru adding the following in [ProjectName]-info.plist:

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
</dict>

And finally could get it work on my latest iOS mobile.
I had the following:

in config.xml but this was not enough to get it work and we need to add NSAppTransportSecurity entry in the config.xml.


#3

In iOS9 only https requests are allowed by default. If you can get the video with https-host everything is fine.
In other cases you need to change you info.plist file in your ios build.