gilesvangruisen / Swift-YouTube-Player

Swift library for embedding and controlling YouTube videos in your iOS applications via WKWebView!
MIT License
874 stars 282 forks source link

How to auto play in PiP? #224

Open noahbino opened 2 years ago

noahbino commented 2 years ago

Is there a way automatically load the YoutubePlayerView as Picture in Picture or at least in full screen?

func presentPiPYTVideo(url: URL){
        guard let topVC = UIApplication.topViewController() else {return}
        let youtubePlayerView = YouTubePlayerView(frame: topVC.view.bounds)
        topVC.view.addSubview(youtubePlayerView)
        youtubePlayerView.loadVideoURL(url)
        //youtubePlayerView.loadPictureinPicture()  <- Anything like this?
    }