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

Removing more videos view #213

Open
thilakks opened this issue Dec 17, 2020 · 2 comments
Open

Removing more videos view #213

thilakks opened this issue Dec 17, 2020 · 2 comments

Comments

@thilakks
Copy link

How to remove more videos list view in YouTube player

@daliborristic883
Copy link

Any updates? I don't need to show more videos list view in YouTube player.

@bradleyandrew
Copy link

I figured it out. You need to create some parameters and then pass them into the 'videoPlayer' prior to calling 'loadVideo'. Please see below for my code, the last section is for the parameters.

        var videoPlayer = YouTubePlayerView(frame: .zero)
        videoPlayer.delegate = self
        view.addSubview(videoPlayer)

        videoPlayer.translatesAutoresizingMaskIntoConstraints = false
        videoPlayer.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0).isActive = true
        videoPlayer.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0).isActive = true
        videoPlayer.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
        videoPlayer.heightAnchor.constraint(equalTo: videoPlayer.widthAnchor, multiplier: 16/9).isActive = true
        
        var parameters = YouTubePlayerView.YouTubePlayerParameters()
        parameters["playsinline"] = "1" as AnyObject
        parameters["modestbranding"] = "1" as AnyObject
        parameters["rel"] = "0" as AnyObject
        videoPlayer.playerVars = parameters
        videoPlayer.loadVideoID(learnVideo!.id)

Options for parameters can be explored here: https://developers.google.com/youtube/player_parameters.html

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