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

Orientation issue in PIP mode #522

Open
ashwin-nath-m opened this issue Dec 5, 2024 · 0 comments
Open

Orientation issue in PIP mode #522

ashwin-nath-m opened this issue Dec 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ashwin-nath-m
Copy link

Describe the bug
Switching to PIP mode automatically changes the video orientation to landscape

Full Screen PIP
IMG_0572 IMG_0573

Relevant code for setup

 lazy var remoteVideoView = {
        let r = VideoView()
        r.layoutMode = .fill
        r.backgroundColor = .black
        r.clipsToBounds = true
        // r.isDebugMode = true
        r.tag = 1723
        r.translatesAutoresizingMaskIntoConstraints = false
        r.renderMode = .sampleBuffer
        return r
    }()

func setupPIP() {
        DispatchQueue.main.async {
            if AVPictureInPictureController.isPictureInPictureSupported(),
               let sampleBufferLayer = self.remoteVideoView.avSampleBufferDisplayLayer {
                sampleBufferLayer.videoGravity = .resizeAspect
                let contentSource = AVPictureInPictureController.ContentSource(
                    sampleBufferDisplayLayer: sampleBufferLayer,
                    playbackDelegate: self
                )
                
                self.pipController = AVPictureInPictureController(contentSource: contentSource)
                self.pipController?.requiresLinearPlayback = true
                self.pipController?.setValue(true, forKey: "controlsStyle")
            } else {
                print("PiP is not supported on this device.>\(AVPictureInPictureController.isPictureInPictureSupported())" )
            }
        }
    }

How can I change the orientation of PIP to portrait?

SDK Version
2.0.18

iOS/macOS Version
18.1.1

Xcode Version
16.1

@ashwin-nath-m ashwin-nath-m added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants