2017-08-02 85 views
0

大家好,我正在嘗試使用Avplayer播放s3視頻。現在,如果我播放視頻,則在整個視頻被緩衝後,視頻開始播放。所以我加了player.automaticallyWaitsToMinimizeStalling = false,但現在的視頻會自動暫停使用AVplayer播放s3視頻時出現的問題

import UIKit 
import AVFoundation 
import AVKit 
class ViewController: UIViewController { 
    var player: AVPlayer! 
    var item : AVPlayerItem! 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     item = AVPlayerItem(url: URL(string: "https://cent-churchconnect.s3-ap-southeast-2.amazonaws.com/cent-churchconnect/testAdmin/eb8cc8b5-80e0-468a-a2c9-979cf1b5ac76_toystory.mp4")!) 
     player = AVPlayer(playerItem: item) 
     let controller = AVPlayerViewController() 
     present(controller, animated: true) { _ in } 
     controller.player = player 
     addChildViewController(controller) 
     view.addSubview(controller.view) 
     controller.view.frame = CGRect(x: 0, y: 50, width: self.view.frame.size.width, height: 300) 
     controller.player = player 
     controller.showsPlaybackControls = true 
     if #available(iOS 10.0, *) { 
      player.automaticallyWaitsToMinimizeStalling = false 
      player.play() 
     } else { 
      // Fallback on earlier versions 
     } 
    } 
} 
+0

你這是什麼意思S3? –

+0

aws服務s3存儲桶 –

回答