Use YouTube-Player-iOS-Helper :
Step 1 : add the pod 'youtube-ios-player-helper', '0.1.4' to your Podfile and run pod install .
Step 2: Implement this code:
import UIKit import youtube_ios_player_helper class ViewController: UIViewController, YTPlayerViewDelegate { @IBOutlet weak var playerView: YTPlayerView! override func viewDidLoad() { super.viewDidLoad() playerView.delegate = self let playerVars = ["playsinline": 1]
Note. If you do not want to show playerVars video, set the rel key to 0 in the playerVars dictionary.
let playerVars = ["playsinline":1, "rel": 0 ]
javimuu
source share