我集成了 iOS Helper Library,用于在应用程序中播放 YouTube 视频。我可以成功播放视频。但是当视频结束时,我会在屏幕上看到下一个/上一个视频的按钮(推荐视频列表)。我只希望重新加载按钮出现在屏幕上以再次播放该特定视频。
我曾尝试提示视频,但这样做后,视频无法播放。
playerview.cueVideo(byId: videoid, startSeconds: 00, suggestQuality: .large)
谁能帮帮我。
最佳答案
这是我使用 Swift 3 播放 YouTube 视频的方法:
func loadYouTubeVideo() {
let YouTubeVideoID = getYouTubeVideoID(youTubeVideoURL: QRValue)
if(YouTubeVideoID != nil) {
print(YouTubeVideoID! + " is YouTube video ID")
let playerVars = [
"origin": "http://www.youtube.com",
"start" : 0,
"end" : 30,
"playsinline" : 1,
"showinfo" : 1,
"rel" : 0,
"modestbranding" : 1,
"controls" : 0,
] as [String : Any]
YouTubePlayerView.load(withVideoId: YouTubeVideoID, playerVars: playerVars)
} else {
launchYouTubeIssueAlertDialog()
}
}
关于ios - 在 YTPlayerView 中仅提示一个视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43347076/