How to detect AVPlayer actually started to play in swift

后端 未结 7 1468
情话喂你
情话喂你 2020-12-16 10:59

Hello I have set my UISliderminimum value to 0.00. Then I set it\'s max value in this way.

self.viewPlayer.layer.addSublayer(playerLayer)
    le         


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 11:29

    SUPER EASY SOLUTION SWIFT 4-5:

    Just check the timeControlStatus!: (also works with PlayerQueue)

        if avPlayer?.timeControlStatus.rawValue == 2 {
           
        //video is playing (playing)
    
        } else if avPlayer?.timeControlStatus.rawValue == 0 { 
        
        //video is not playing (paused)
        
        }
    

    the raw value will give you its current state :)

提交回复
热议问题