ios - AVPlayer override video controls -
i need notified when control button (on video) pressed. example if tap on "pause" or on "full scren" button need implement logic. can override methods of avplayerviewcontroller? found avplayerviewcontrollerdelegate can't find methods override.
i tried add observer avplayer
player.addobserver(self, forkeypath: "status", options:nskeyvalueobservingoptions(), context: nil) and used:
override func observevalueforkeypath(keypath: string, ofobject object: anyobject, change: [string : anyobject], context: unsafemutablepointer<void>) { ... } but notification when video played: method isn't called if tap on control button.
thanks
keypaths different, swift, check play/pause after clicked:
player .addobserver(self, forkeypath: "rate", options: nskeyvalueobservingoptions.new, context: nil) and in
observevalueforkeypath check this
if ((change!["new"] as! int) == 1) ^ returns if video played or paused true/false cases
Comments
Post a Comment