SwiftAudioEx icon indicating copy to clipboard operation
SwiftAudioEx copied to clipboard

Need ability to access inner AVPlayer

Open lostchopstik opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. My company uses a third-party analytics platform that requires an instance of AVPlayer in order to hook to their adapter. I cannot cast AudioPlayer to an AVPlayer and there is no property for it.

Describe the solution or feature you would like It would be handy if there was a property like innerPlayer that gives access to the AVPlayer inside the wrapper.

Describe alternatives you've considered None at present other than having to ditch this library and be sad.

lostchopstik avatar Nov 09 '22 23:11 lostchopstik

Hello everyone, My company would also have this need, we could possibly work on a push request, so as to expose the player to the outside world.

Our idea would be to:

  • Create a property in AVPlayerWrapper.swift and modify the related AVPlayerWrapperProtocol.swift
public var playerInner: AVPlayer? = nil
  • Initialize playerInner in the setupAVPlayer() method:
playerInner = avPlayer
  • Expose the proriety for external access in AudioPlayer.swift:
public var playerInner: avPlayer? {
      wrapper.playerInner
}

Could this kind of solution be in line with the design? If so, we could proceed with a pull request.

We look forward to hearing from you on whether to proceed or evaluate other solutions.

We thank you for your work.

Regards, Roland

rolandvar avatar May 21 '24 16:05 rolandvar