0

だから私はこのプロジェクトソースからいくつかのソースコードを編集しようとしています... https://github.com/ariiyu/VideoPlayerSample

だから、単にビデオパスとファイルを置き換えようとすると、クラッシュしてしまい、その理由がわかりません??

これはViewControllerのソースコードの1つです...

import UIKit
import AVFoundation
import AVKit

class SecondViewController: AVPlayerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

// I try to replace the string with my movie file here and crashes
        let moviePath = NSBundle.mainBundle().pathForResource("hogevideo", ofType: "mp4")!
        let url = NSURL(fileURLWithPath: moviePath)


        let playerItem = AVPlayerItem(URL: url)


        player = AVPlayer(playerItem: playerItem)


        player.play()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
4

1 に答える 1