YoutubeKit
YoutubeKit copied to clipboard
Video plays only in storyboard and doesn't work with xib files.
trafficstars
Hi!
So, it works without problems when I use Main.storyboard, but loading player in xib files fails.
When I make self.view.addSubview(player) got youtubeIframeAPIFailedToLoad, but changing it to self.videoView = player solves it, but still video not appearing.
Logs:
playerReady
player(_:didChangeState:):unstarted
player(_:didChangeState:):buffering
player(_:didChangeQuality:):hd720
apiDidChange
Creating player:
player = YTSwiftyPlayer(
frame: CGRect(x: 0, y: 0, width: self.videoView.frame.width, height: self.videoView.frame.height),
playerVars: [.videoID("nKMk3q7bHjA"), .showFullScreenButton(false),.showControls(.showAfterPlaying), .showRelatedVideo(false), .playsInline(true), .showInfo(false), .showModestbranding(false)])
It would be great if you could post here an example project with demonstration the issue.
fileprivate func setupYoutubeVideo(){
youtubePlayer = YTSwiftyPlayer(
frame: CGRect(x: 0, y: 0, width: backView.frame.size.width, height: backView.frame.size.height),
playerVars: [
.playsInline(true),
.videoID(videoUrl.getVideoIDFromYoutubeUrl()),
.loopVideo(false),
.showRelatedVideo(false),
])
youtubePlayer?.autoplay = true
//youtubePlayer?.backgroundColor = .black
self.backView.addSubview(youtubePlayer ?? YTSwiftyPlayer())
//youtubePlayer?.delegate = self
youtubePlayer?.loadPlayer()
}
Please take a look at this related pull request: https://github.com/rinov/YoutubeKit/issues/28