-
Notifications
You must be signed in to change notification settings - Fork 13
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
Some examples of implementing Avalonia controls for displaying video (using OpenGL and Software rendering). #7
Comments
Awesome thanks! |
For Desktop, there is OpenGlVideoView and NativeVideoView, what's the difference between both? NativeVideoView is not used. And on Android, there is no OpenGlVideoView. Can't that renderer be used on Andrroid? |
Refactoring is done. Now got some pretty clean code. For some reason, your Android version runs under "AndroidSample" folder; but I can't make my version to run. Can't figure out what I'm missing. Also, although your Android version runs, it crashes if we try to switch windows. There's still more work to do on the Android implementation; and then iOS. |
You will have to read the libmpv documentation to understand the difference between these player embedding technologies
Yes you are right. There is a problem when switching windows. It's probably trivial, but I don't have time to fix this bug at the moment. My interest was just to try to run on android. Perhaps in the future I will return to this problem. |
Notes about iOS. There is no easy way to get compiled libmpv library for iOS. Unfortunately, I don't have a macOS computer to try it out. You will most likely have to compile it yourself for that platform. |
Notes about embedding the player. It seems to be better to use native embedding under Windows to achieve better video playback results. In my example, the implementation of naive embedding is not complete. How to implement better, you can look at the example of the implementation of LibVLC In short, there is one problem with native embedding. It is not possible in a simple way to display the control element on top of the area in which the video is played. Therefore, it is necessary to take additional actions to achieve this result. In that example, LibvLC is used as a video player. For LibMPV it will be completely similar. |
I started implementing the full API of commands and properties but that's a lot of work. Properties work for basic data types, but strangely, GetAsync doesn't work on string values but works for other data types? Complex data types aren't yet implemented. Still a lot of work to do. I'll leave it in the current state and add it to MediaPlayerUI. Here's a TODO list. It may sit in the current state for a while unless someone picks up the work. |
Precisely because there are so many properties, I did not do this in my implementation. In addition to simple properties, there are many more properties for setting audio and video filters. Of course, the absence of mapping will not meet the classical requirements of MVVM, but this is the reality. It is not always appropriate. |
I had already done the full API mapping for controlling the player via IPC controller, so I copy-pasted that; but there are quite a lot of differences and I did not finish fixing the changes. MVVM does not apply to the library. You can create your own derived controls that implement the properties you need as MVVM, or it passes the MpvContext to the ViewModel, from there the ViewModel has full control. But the library itself doesn't care what UI or design pattern you use. The main thing is to make it easy to test. I haven't looked into that. Your ViewModel currently takes a hard reference to MpvContext... that might need to be swapped with an interface. Could generate an interface once the API is stable. |
With the full properties mapping, added auto-listening to property changes which is pretty cool. Binding to the property It's now working with MediaPlayerUI so I'll just publish the packages as-is. They can be fixed and improved later, but I think a decent video player for Avalonia is just overdue. Ah, there's also the issue of making the screen black on stop. |
LibMpv.Client - a complete libmpv API wrapper and some examples of implementing Avalonia controls for displaying video (using OpenGL and Software rendering).
Works on Linux and Windows (maybe MacOS)
The text was updated successfully, but these errors were encountered: