I have a very basic/simple swift app, with a WebView embedded that links to a Youtube video via URL. See the below entire code. I want to add 10 other Youtube URL's and randomly populate them in the WebView via a button called "shuffleButton". How can I, very simply, use this button to load a video and then randomly shuffle through them. Can I locate the master list of video URL's in this same ViewController? Thanks!
// ViewController.swift
@IBOutlet var videoView: UIWebView!
@IBOutlet var shuffleButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let youtubeURL = "https://www.youtube.com/embed/Rg6GLVUnnpM"
videoView.allowsInlineMediaPlayback = true
videoView.loadHTMLString("<iframe width=\"\(videoView.frame.width)\" height=\"\(videoView.frame.height)\" src=\"\(youtubeURL)?&playsinline=1\" frameborder=\"0\" allowfullscreen></iframe>", baseURL: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}