0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS
MIT License
2.92k stars 626 forks source link

Full screen for swift - XCDYouTubeKit Demo/iOS Demo/AVPlayerViewControllerManager.swift not works #474

Closed anveshfactorly closed 3 years ago

anveshfactorly commented 4 years ago

Hello there

I have tried swift version of it and when i click on default icon of full screen video stop and shows black screen

Any solution ?

SoneeJohn commented 4 years ago

Hi, are you trying this on the simulator? I haven't add any issues like the one your described.

Screen Shot 2020-04-06 at 7 32 30 AM

cristea2017 commented 4 years ago

Hello there

I have tried swift version of it and when i click on default icon of full screen video stop and shows black screen

Any solution ?

you can create own full screen using avplayerlayer check this app: https://apps.apple.com/us/app/iburn-music-player-stream/id1506178737?ls=1

here is example :

public func setUp(withLayer:AVPlayerLayer){
        playLayer = withLayer
    UIView.animate(withDuration: 0.3) {

            self.transform = CGAffineTransform(rotationAngle: CGFloat(90 * Float.pi/180))
            self.frame = (UIApplication.as_topViewController()?.view.bounds)!
        }
        // THIS IS NO NEEDET IF TRANSFORM VIEW
        //        withLayer.transform = CATransform3DMakeRotation(90.0 / 180.0 * .pi, 0.0, 0.0, 1.0)
        withLayer.frame = self.bounds
        withLayer.contentsGravity = .resizeAspect
        coverView.layer.addSublayer(withLayer)

        if !musicManager.videoPlayer!.isPlaying{
            btnPlay.setImage(#imageLiteral(resourceName: "fullPlay"), for: .normal)
            btnPlay.tag = 1
        }

    }