i am trying to play Youtube videos on my app. I am using YTPlayerView
library for playing a video by video id. Problem is when i am trying to play a list of videos player showing an error that "An error occurred. Please try again later. (Playback ID: someid)".
I am using the following code for playing a single video
@IBOutlet weak var playerView: YTPlayerView! // story board connection
let params = ["controls" : 2, "playsinline" : 1, "autohide" :1, "showinfo" : 0, "modestbranding" : 0, "cc_load_policy" : 0, "rel" : 1] //,
playerView.delegate = self
playerView.loadWithVideoId("v_I0rA72IJE", playerVars:params)
Its working fine for a single video. But when i try to load a list of videos by using the following code i am getting that error.
playerView.loadWithPlayerParams(params)
playerView.loadPlaylistByVideos(["v_I0rA72IJE","l-ujrOIL-9M","yw002vpbClA"], index: 0, startSeconds: 0, suggestedQuality: YTPlaybackQuality.Default)
or
playerView.cuePlaylistByVideos(["v_I0rA72IJE","l-ujrOIL-9M","yw002vpbClA"], index: 0, startSeconds: 0, suggestedQuality: YTPlaybackQuality.Default)
Please help me to solve the issue. Please correct me if i am doing anything wrong.
Not an exact solution, but we can proceed for now
First load a single video
inside the
playerViewDidBecomeReady(playerView: YTPlayerView)
delegate method load that playlist