5
當我使用AVPlayer播放視頻時,當視頻開始播放時,我無法獲取當前項目。我使用下面的代碼來獲得當前時間。 請幫我解決下面的問題。在此先感謝獲取AVPlayer播放視頻的當前時間ios
let item1 = AVPlayerItem.init(URL: NSURL(string:path))
let player = AVPlayer(playerItem: item1)
layer?.player = player;
player?.play
let currentItem:AVPlayerItem = player!.currentItem
let currentTime:NSTimeInterval = CMTimeGetSeconds(currentItem.currentTime())
檢查您的視頻是否正在播放......你最好發佈更多的代碼 – 2015-04-03 13:31:39
@AlexChan我怎麼能確定視頻是否是打還是不 – 2015-04-06 06:32:04
我不知道這是確定:'讓物品1 = AVPlayerItem .init(URL:NSURL(string:path))'。但試試這個:'let item1 = AVPlayerItem(URL:xxx)' – 2015-04-07 01:57:36