Skip to content
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

[question] How to integrate SurfaceView to make a gui for mpv #36

Closed
JingMatrix opened this issue Dec 9, 2022 · 1 comment
Closed

Comments

@JingMatrix
Copy link

Hello, your project is very promising to me because I want to make a simple gui for mpv inside termux.
Currently, mpv only need the id to android.view.Surface to play its video through the option --wid=<ID>:

On  Android,  the  ID  is  interpreted as android.view.Surface.
Pass it as a value cast to intptr_t.
Use with --vo=mediacodec_embed and  --hwdec=mediacodec for  direct  rendering  using  MediaCodec,
or  with  --vo=gpu   --gpu-context=android (with or without --hwdec=mediacodec-copy).

Could you tell me how to integrate a SurfaceView?
In this way I can return the Surface id from its SurfaceHolder.Callback.

Would it be as simple as adding a TextView?

@tareksander
Copy link
Member

I'm adding SurfaceView for use in applications, but you can't just use it in mpv. The problem is that the Android version of mpv expects to be run in an Android app process, but Termux applications are run outside the main app process. But you can get mpv to render to a buffer. You could use that together with the shared buffer function for ImageView to display an image. Here is an example for using a pixel buffer with ImageView.

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

No branches or pull requests

2 participants