I am trying to play a video file from my network path which is
\\alan\movies\kids\alladin.mp4.
I am able to see and browse the directory from my Mac.
The code below work fine if I add the video file as part of the project
import UIKit
import AVFoundation
import AVKit
class ViewController: AVPlayerViewController {
@IBOutlet var vwVideoView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
playVideo()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
private func playVideo() {
if let path = NSBundle.mainBundle().pathForResource("Alladin", ofType: "mp4") {
let url = NSURL(fileURLWithPath: path)
player = AVPlayer(URL: url)
}
else {
print("Oops, something wrong when playing video")
}
}
}
I copied the video file from network folder to my local movies folder as below
NSBundle.mainBundle().pathForResource("file://localhost/Users/alan/Movies/test/Alladin", ofType: "mp4")
The video file is still not playing. Is this even possible to play video file from network?
regards, -Alan-