Reputation: 9503
I've been trying to do video streaming and haven't resolved the KVO issue. I saw an alternate way via prepareForSegue
as follows:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let destination = segue.destinationViewController as! AVPlayerViewController
let url = NSURL(string: "http://www.ebookfrenzy.com/ios_book/movie/movie.mov")
destination.player = AVPlayer(URL: url!)
}
This works (iOS 9: if you bypass the App Transport Security).
So I substituted the following URL (.mp4):
http://sachinchoolur.github.io/lightGallery/static/videos/video1.mp4
What I got was a blank screen. As if it was trying to load and perhaps timed out.
Then I tried a .mpg file of the URL:
http://files.parsetfss.com/6b8388b7-14c6-431a-a795-2b33f9d47081/tfss-2d72ec5d-8a8d-467b-b799-20c06be52ddb-ngc4261_1.mpg
Of which I got this:
Questions:
Why can't I play the .mp4 file? -- Is it due to size? Do I need to do a KVO or NSNotification observation here?
Why can't I play the .mpg file? -- Is it due to wrong format?
Upvotes: 1
Views: 1441
Reputation: 1729
since adding that comment i have just realised the problem i had, maybe its the same. Did you change the server domain in the plist file when changing to a completely different video stored on a different domain?
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>myDomain.co.uk</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
the 'myDomain.co.uk' needs to change to the where the video is kept, server address
Upvotes: 1