2

最初の UIViewController でビデオを録画し、このビデオをファイルに書き込み、このビデオを 2 番目の UIViewController で表示したいのですが、ビデオの代わりに黒いフレームが表示されることがあります。

player.status.rawValueそしてplayer.currentItem?.status.rawValue毎回0です。

ファイルは毎回ここにあり、処理できるのでvideoURL問題ありません。黒い画面だけで、エラーは発生しません。

    videoURLAsset = videoAsset as! AVURLAsset
    let videoURL = videoURLAsset.URL

    if playerLayer != nil {
        player = nil
        playerLayer.removeFromSuperlayer()
    }

    player = AVPlayer(URL: videoURL)
    player.volume = 0.0
    playerLayer = AVPlayerLayer(player: player)
    playerLayer.backgroundColor = UIColor.blackColor().CGColor
    playerLayer.frame = CGRectMake(10, 70, screenWidth - 20, screenHeight / 2 - 90)

    self.view.layer.addSublayer(playerLayer)
    player.play()

私の間違いは何ですか?

4

0 に答える 0