ios - Swift: How to access player object of full screen HTML video? -


i want able hold reference avplayer instance takes on screen when playing html videos full screen embedded browsers. first approach this:

extension avplayerviewcontroller {      override public func viewdidappear(animated: bool) {       super.viewdidappear(animated)        print("herezzzzzzzzzzzzzzzzzzzzzzzzzzz") // prints correctly       print(self.player) // prints nil     } } 

however returns nil. i'm trying different approach. want override either initializer or play method of avplayer can't seem without getting objective-c selector conflicts.

import avkit import mediaplayer  extension avplayer {   override func play() { // doesn't work. example of want     super.play()      print("do stuff here")   } } 

is there way override 1 of avplayer's instance methods can store reference self? or not avplayer?

you can't override methods extension. or more precisely, compiler allows so, doesn't work. see thread: overriding methods in swift extensions

you're not supposed subclass avplayerviewcontroller.

why can't read avplayerviewcontrollers player property in class creates it?


Comments