Skip to content

Conversation

@xephosbot
Copy link
Contributor

This PR refactors the iOS video player implementation to use a AVPlayerLayer instead of AVPlayerViewController, playback state is tracked using KVO and a couple of small UX fixes, such as smoothing out timeline slider jitter and cancelling initialization if the screen is left quickly

Copy link
Owner

@kdroidFilter kdroidFilter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, it's a very nice piece of work!

@xephosbot
Copy link
Contributor Author

xephosbot commented Jan 7, 2026

@kdroidFilter Did you check whether errors occur with enableCInteropCommonization enabled?
It was building successfully for iOS even without this option, but the IDE could not detect NSKeyValueObservingProtocol and showed missing reference errors.
Unfortunately, I don’t have a Windows or Linux device to check this.

@kdroidFilter
Copy link
Owner

I'll try to fix that tonight. I haven't had time to try yet But from what I've seen, I like it a lot :)

var player: AVPlayer? by mutableStateOf(null)
private set

var playerLayer: AVPlayerLayer? by mutableStateOf(null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be useful to provide for those who want to implement Picture-in-Picture or something similar.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really like to create an abstraction for picture-in-picture; I need to see if it's possible on all platforms. At first glance, I don't see any problems apart from the lack of time and funding :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve successfully implemented picture-in-picture in my test project for Android and iOS; however, I have no idea how this would be implemented on other platforms. It might not make much sense on desktop. On the web, this is already handled by the browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current implementation, library users can easily implement PiP on Android themselves (as I did). On iOS, a reference to AVPlayerLayer is required, so as a temporary solution I suggest allowing users to implement PiP on their own.

@kdroidFilter kdroidFilter merged commit ea695c2 into kdroidFilter:master Jan 10, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants