我想在我的URL
文件中抓取一个JSON
,我已成功完成并正确解析它。
我无法让AVPlayer
来处理解析网址,任何帮助都会感激不尽!谢谢!
import UIKit
import AVKit
class TrailerVC: UIViewController {
//calling var from different cell where it has the data
var film: FilmCell!
//film.filmvideoFile stores the url.
override func viewDidLoad() {
super.viewDidLoad()
let videoURL = URL(string: "\(film.filmvideoFile)" )
let player = AVPlayer(url: videoURL!)
let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = view.bounds
view.layer.addSublayer(playerLayer)
player.play()
}
}