Refactor iOS VideoPlayer#156
Conversation
|
@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.
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.
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.
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.
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