flowkey / UIKit-cross-platform

Cross-platform Swift implementation of UIKit, mostly for Android
MIT License
598 stars 40 forks source link

Remove global AVPlayer instance #382

Open rikner opened 1 year ago

rikner commented 1 year ago

Fixes #

Type of change:

Motivation (current vs expected behavior)

We have a global AVPlayer instance in order to be able to reference our AVPlayer inside JNI callbacks. While this works it's not a good practice and wouldn't work anymore once there are more than on AVPlayer instances. This PR saves the memory address of our AVPlayer inside the kotlin implementation (userContext) which we can use to later retrieve our player instance in the native callbacks.

Please check if the PR fulfills these requirements