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
[x] Self-review: I am confident this is the simplest and clearest way to achieve the expected behaviour
[x] There are no dependencies on other PRs or I have linked dependencies through Zenhub
[x] The commit messages are clean and understandable
[x] Tests for the changes have been added (for bug fixes / features)
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