12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // YouTubeViewController.swift
- // LMS
- //
- // Created by Suraj Kumar Mandal on 19/10/23.
- //
- import UIKit
- import WebKit
- class YouTubeViewController: UIViewController {
-
- @IBOutlet var navigationBar: UINavigationBar!
- @IBOutlet var youtubeWebView: WKWebView!
-
- var pageName = String()
- var youtubeId = String()
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- // Do any additional setup after loading the view.
- navigationBar.topItem?.title = pageName
- // Set the navigation delegate to monitor page load progress.
- //youtubeWebView.navigationDelegate = self
-
- // Replace "VIDEO_ID" with your YouTube video's ID.
- let videoID = youtubeId
- let videoURL = URL(string: "https://www.youtube.com/embed/\(videoID)")
-
- if let url = videoURL {
- let request = URLRequest(url: url)
- youtubeWebView.load(request)
- }
- }
-
-
- /*
- // MARK: - Navigation
-
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- // Get the new view controller using segue.destination.
- // Pass the selected object to the new view controller.
- }
- */
-
- @IBAction func backAction(_ sender: UIBarButtonItem) {
- self.navigationController?.popViewController(animated: true)
- }
-
- }
|