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

Player won't resize on iOS when using Metal #3

Open
funniray opened this issue Apr 1, 2024 · 6 comments
Open

Player won't resize on iOS when using Metal #3

funniray opened this issue Apr 1, 2024 · 6 comments

Comments

@funniray
Copy link

funniray commented Apr 1, 2024

Hey there,

I've been playing with the demo projects provided, but I don't seem to be able to get MPV to detect the metal layer resizing...
I've added the following to MPVMetalViewController

    override func viewDidLayoutSubviews() {
        let size = view.frame.size
        let scale = UIScreen.main.nativeScale
        
        metalLayer.frame = view.frame
        metalLayer.drawableSize = CGSize(width: size.width * scale, height: size.height * scale)
    }

I can see with the performance overlay that the metal layer has resized, however, the video content isn't modified.

Is there any way to get resizing to work with libmpv on iOS?

@alexiscn
Copy link

alexiscn commented Apr 5, 2024

try following code

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        metalLayer.frame = view.bounds
        metalLayer.contentsGravity = .resizeAspect
    }

@funniray
Copy link
Author

funniray commented Apr 5, 2024

@alexiscn

The code did work and the view does fill the screen, however the metal layer's resolution never changed. I would prefer the resolution of the metal layer to be correct so that subtitles are rendered properly.

You can see in the clip below that the resolution of the metal layer never changed

RPReplay_Final1712320506.MP4

@alexiscn
Copy link

alexiscn commented Apr 6, 2024

You may have a look the plex fix the sizing issue on moltenvk . It seems they have a solution to fix the problem. But I could not make it work.

@funniray
Copy link
Author

After quite a bit of trial and error -- and trying the plex fork of mpv -- I don't believe it's currently possible. It doesn't seem like anything that Plex has published so far has had fully working moltenvk resizing... I've tried multiple commits, but nothing appears to work :/

@JARMourato
Copy link

JARMourato commented Jul 18, 2024

@alexiscn @funniray were either of you able to get the layer to resize correctly when device rotates / orientation changes ?

@funniray
Copy link
Author

was any of you able to get the layer to resize correctly when device rotates / orientation changes ?

Nope, I just ended up using openGL for iOS/macOS and then only using metal on tvOS as it's unlikely for a tv to resize.

@cxfksword cxfksword transferred this issue from cxfksword/MPVKit Jul 19, 2024
@cxfksword cxfksword transferred this issue from another repository Jul 19, 2024
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

3 participants