-
Notifications
You must be signed in to change notification settings - Fork 23
Refactor iOS VideoPlayer #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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!
|
@kdroidFilter Did you check whether errors occur with |
|
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :/
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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