Files
Woka_Native_iOS/WOKA/Theme/Controller/RadioVC.swift
Bilal adb2e2684c - solved issue of fullscreen for player. now transforming the view
- updated api for shop procuts, with lazy loading and proper structure
- added loading indicator when user navigates to bottom indicator will be shown
- Made shop product details view.
- Added carousel with page indicator
- added shadows to the images
- added selection option for address
- made address table dynamic
- added pincode_serviceability_check_edd for checking the delivery date of the selected address.
2024-07-26 23:21:09 +05:30

94 lines
2.7 KiB
Swift

//
// RadioVC.swift
// WOKA
//
// Created by MacBook Pro on 13/06/24.
//
import UIKit
import WebKit
class RadioVC: UIViewController, WKNavigationDelegate {
@IBOutlet var webView: WKWebView!
var url = "https://wokaland.com/admin/api/woka_fm"
// var url = "https://s4.voscast.com:9161/stream" provide on 18th july
// var url = "https://planetcast.radiowalla.in/radio.mp3" //url from 24th july
// Radio Server Address (Direct)
// http://live3.rcast.net:9080 - This will not load as iOS directly rejects http
// SSL Stream Address (Proxy)
// https://stream.rcast.net/71643 - Playing in iOS and loading fine
// non-SSL Stream Address (Direct)
// http://live3.rcast.net:9080/;stream - This will not work as it is http
// Listening Page
// https://dir.rcast.net/radio/71643 - This is loading fine. but its showing unknown track
@IBOutlet weak var backView: UIView!
deinit {
unloadWebView()
}
// WKNavigationDelegate methods
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
print("Failed to load: \(error.localizedDescription)")
}
func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
print("Failed to start loading: \(error.localizedDescription)")
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
print("Finished loading")
}
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 14.0, *) {
webView.configuration.defaultWebpagePreferences.allowsContentJavaScript = true
} else {
// Fallback on earlier versions
webView.configuration.preferences.javaScriptEnabled = true
}
let radioURL = URL(string: url)!
let request = URLRequest(url: radioURL)
webView.load(request)
webView.navigationDelegate = self
backView.addTapGesture {
self.dismiss(animated: true) {
self.unloadWebView()
}
}
}
override func viewDidDisappear(_ animated: Bool) {
webView.stopLoading()
}
@IBAction func closeBtnTapped(_ sender: UIButton) {
self.dismiss(animated: true) {
self.unloadWebView()
}
}
func unloadWebView() {
// Cancel any ongoing navigation
webView.stopLoading()
// Set delegates to nil
webView.navigationDelegate = nil
webView.uiDelegate = nil
// Remove from superview
webView.removeFromSuperview()
// Release the web view
webView = nil
}
}