fixed the player issues

This commit is contained in:
2024-07-17 20:05:39 +05:30
parent 850593c0c8
commit aadd946ffa
6 changed files with 70 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'
platform :ios, '14.0'
target 'WOKA' do
# Comment the next line if you don't want to use dynamic frameworks
@@ -17,14 +17,14 @@ target 'WOKA' do
pod 'SDWebImage' , '~> 5.19.4'
#JwPlayer
# pod 'JWPlayerKit', '>= 4.0.0'
pod 'JWPlayerKit', '~> 4.19.2'
# Bottom line is for removing IPHONEOS_DEPLOYMENT_TARGET
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)

View File

@@ -38,6 +38,7 @@
525327D62BFCC23600F64283 /* SideMenuVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525327D52BFCC23600F64283 /* SideMenuVM.swift */; };
525327D92BFCDDF700F64283 /* AuthFuncStartupSoundHandling.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525327D82BFCDDF700F64283 /* AuthFuncStartupSoundHandling.swift */; };
5257B2652BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5257B2642BDFB6F50086D79B /* CheckPhoneHomeBtnOrNotch.swift */; };
5258464D2C4802E4004F074B /* RSKPlaceholderTextView in Frameworks */ = {isa = PBXBuildFile; productRef = 5258464C2C4802E4004F074B /* RSKPlaceholderTextView */; };
525953CF2BE8B28F00191286 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525953CE2BE8B28F00191286 /* Utilities.swift */; };
525953D12BE8B2B200191286 /* LLSpinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525953D02BE8B2B200191286 /* LLSpinner.swift */; };
525953D42BE8B2DF00191286 /* UIApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525953D32BE8B2DF00191286 /* UIApplication.swift */; };
@@ -63,7 +64,6 @@
5259545E2BEBBA1A00191286 /* LoadingIndicatorImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5259545D2BEBBA1A00191286 /* LoadingIndicatorImageView.swift */; };
525FC61D2C3D3DC30049145D /* AVAssetMods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525FC61C2C3D3DC30049145D /* AVAssetMods.swift */; };
525FC65D2C3D57D80049145D /* TestingKaraokeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525FC65C2C3D57D80049145D /* TestingKaraokeVC.swift */; };
525FD79B2C2AFB990062C80F /* JWPlayerKit in Frameworks */ = {isa = PBXBuildFile; productRef = 525FD79A2C2AFB990062C80F /* JWPlayerKit */; };
52663FF52BDFAB830001D8CE /* TextFieldErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF42BDFAB830001D8CE /* TextFieldErrorView.swift */; };
52663FF72BDFACF60001D8CE /* ShadowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF62BDFACF60001D8CE /* ShadowView.swift */; };
52663FF92BDFAF110001D8CE /* EmailVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52663FF82BDFAF110001D8CE /* EmailVM.swift */; };
@@ -185,7 +185,6 @@
9C0A853F2BEE35340093783D /* ForgotPassDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A853E2BEE35340093783D /* ForgotPassDM.swift */; };
9C0A85412BEE35670093783D /* ResetPassUserNameVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A85402BEE35670093783D /* ResetPassUserNameVM.swift */; };
9C0A85432BEE3EC90093783D /* NewPasswordVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C0A85422BEE3EC90093783D /* NewPasswordVM.swift */; };
9C1C69FA2C106B290035B2C7 /* RSKPlaceholderTextView in Frameworks */ = {isa = PBXBuildFile; productRef = 9C1C69F92C106B290035B2C7 /* RSKPlaceholderTextView */; };
9C1C69FC2C106C240035B2C7 /* ContactSupportVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C1C69FB2C106C240035B2C7 /* ContactSupportVM.swift */; };
9C21F81C2C37E1FA0050BFCC /* KaraokeContinueWatchingDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C21F81B2C37E1FA0050BFCC /* KaraokeContinueWatchingDM.swift */; };
9C21F81E2C37E3CA0050BFCC /* AVPlayerVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C21F81D2C37E3CA0050BFCC /* AVPlayerVC.swift */; };
@@ -549,9 +548,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
525FD79B2C2AFB990062C80F /* JWPlayerKit in Frameworks */,
9C1C69FA2C106B290035B2C7 /* RSKPlaceholderTextView in Frameworks */,
619A5A1BD8BD968ADC83C106 /* Pods_WOKA.framework in Frameworks */,
5258464D2C4802E4004F074B /* RSKPlaceholderTextView in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1505,8 +1503,7 @@
);
name = WOKA;
packageProductDependencies = (
9C1C69F92C106B290035B2C7 /* RSKPlaceholderTextView */,
525FD79A2C2AFB990062C80F /* JWPlayerKit */,
5258464C2C4802E4004F074B /* RSKPlaceholderTextView */,
);
productName = WOKA;
productReference = 523ED25A2BDA2BC700CFED02 /* WOKA.app */;
@@ -1582,8 +1579,7 @@
);
mainGroup = 523ED2512BDA2BC700CFED02;
packageReferences = (
9C1C69F82C106B290035B2C7 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */,
525FD7992C2AFB990062C80F /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */,
5258464B2C4802E4004F074B /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */,
);
productRefGroup = 523ED25B2BDA2BC700CFED02 /* Products */;
projectDirPath = "";
@@ -2147,7 +2143,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -2186,7 +2182,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UIUserInterfaceStyle = Light;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -2322,15 +2318,7 @@
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
525FD7992C2AFB990062C80F /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/jwplayer/JWPlayerKit-package.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.19.1;
};
};
9C1C69F82C106B290035B2C7 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */ = {
5258464B2C4802E4004F074B /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/ruslanskorb/RSKPlaceholderTextView.git";
requirement = {
@@ -2341,14 +2329,9 @@
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
525FD79A2C2AFB990062C80F /* JWPlayerKit */ = {
5258464C2C4802E4004F074B /* RSKPlaceholderTextView */ = {
isa = XCSwiftPackageProductDependency;
package = 525FD7992C2AFB990062C80F /* XCRemoteSwiftPackageReference "JWPlayerKit-package" */;
productName = JWPlayerKit;
};
9C1C69F92C106B290035B2C7 /* RSKPlaceholderTextView */ = {
isa = XCSwiftPackageProductDependency;
package = 9C1C69F82C106B290035B2C7 /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */;
package = 5258464B2C4802E4004F074B /* XCRemoteSwiftPackageReference "RSKPlaceholderTextView" */;
productName = RSKPlaceholderTextView;
};
/* End XCSwiftPackageProductDependency section */

View File

@@ -1112,7 +1112,7 @@
<viewLayoutGuide key="contentLayoutGuide" id="ac6-o2-deF"/>
<viewLayoutGuide key="frameLayoutGuide" id="ijh-ix-uLc"/>
</scrollView>
<view alpha="0.59999999999999998" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ygH-wj-cLk">
<view hidden="YES" alpha="0.59999999999999998" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ygH-wj-cLk">
<rect key="frame" x="0.0" y="116" width="430" height="733"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>

View File

@@ -9,11 +9,11 @@ import UIKit
import JWPlayerKit
import AVKit
class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
class PlayerVC: JWPlayerViewController, JWPlayerViewControllerFullScreenDelegate {
@IBOutlet weak var innerPlayerView: UIView!
var previousScale: CGFloat = 1.0
var contentType : VideoContentType?
var config: JWPlayerConfiguration!
@@ -32,9 +32,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
UIView.setAnimationsEnabled(true)
}
func rotateToPotraitScapeDevice(){
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.myOrientation = .portrait
if #available(iOS 16.0, *) {
@@ -50,7 +48,6 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.rotateToLandsScapeDevice()
}
@objc func applicationDidBecomeActive() {
@@ -60,7 +57,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
if size.width > self.view.frame.size.width {
print("Landscape")
} else {
}else{
DispatchQueue.main.async {
self.dismiss(animated: true)
}
@@ -70,12 +67,14 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
player.configurePlayer(with: config)
self.delegate = self
self.fullScreenDelegate = self
// self.uiDelegate = self
// self.relatedDelegate = self
//Disable Picture in Picture
playerView.allowsPictureInPicturePlayback = false
playerView.captionStyle = .none
// self.navigationController?.isNavigationBarHidden = true
}
override func viewWillDisappear(_ animated: Bool) {
@@ -90,16 +89,6 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
print("LoadTime", loadTime)
}
//Playlist Functions
// override func jwplayerHasSeeked(_ player: any JWPlayer) {
//// if player.getState() != .playing{
//// print("Again Play")
//// player.play()
//// }
// print("Seeked " , player.getState())
// }
override func jwplayerIsReady(_ player: JWPlayer) {
super.jwplayerIsReady(player)
switch contentType {
@@ -118,7 +107,6 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
case .continueWatching,.audioBooks, .games:
player.seek(to: 0)
player.play()
// player.play()
case nil:
break
}
@@ -139,6 +127,8 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
override func jwplayer(_ player: JWPlayer, encounteredWarning code: UInt, message: String) {
super.jwplayer(player, encounteredWarning: code, message: message)
//Handle the reconnecting of video here
print("Warning: \(code) - \(message)")
}

View File

@@ -8,21 +8,43 @@
import UIKit
import WebKit
class RadioVC: UIViewController {
class RadioVC: UIViewController, WKNavigationDelegate {
@IBOutlet weak var webView: WKWebView!
var url = "https://wokastaging.in/api/woka_fm"
@IBOutlet var webView: WKWebView!
var url = "https://wokaland.com/admin/api/woka_fm"
@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()
let radioURL = URL(string: url)!
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) {
@@ -30,7 +52,7 @@ class RadioVC: UIViewController {
}
}
}
override func viewDidDisappear(_ animated: Bool) {
webView.stopLoading()
}
@@ -40,6 +62,7 @@ class RadioVC: UIViewController {
self.unloadWebView()
}
}
func unloadWebView() {
// Cancel any ongoing navigation

View File

@@ -42,7 +42,6 @@ class ThemeOneVM{
private func handleNotificationCenter(){
NotificationCenter.default.addObserver(self, selector: #selector(appDidEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.reloadTheme), name: NSNotification.Name(rawValue: K.NotificationCenterReloads.reloadTheme), object: nil)
}
@@ -216,6 +215,8 @@ class ThemeOneVM{
private func addTapGestureToMovingView(){
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:)))
// tap.numberOfTouchesRequired = 1
tap.numberOfTapsRequired = 1
vc.liveTVView.addGestureRecognizer(tap)
vc.liveTVView.isUserInteractionEnabled = true
}
@@ -225,19 +226,20 @@ class ThemeOneVM{
Utilities.startProgressHUD(msg: "Loading...")
print("tapped")
guard let storyboard = self.vc.storyboard else {
print("Storyboard not found")
Utilities.dismissProgressHUD()
return
}
// guard let storyboard = self.vc.storyboard else {
// print("Storyboard not found")
// Utilities.dismissProgressHUD()
// return
// }
//
// guard let vc = storyboard.instantiateViewController(identifier: "PlayerVC") as? PlayerVC else {
// print("PlayerVC not found")
// Utilities.dismissProgressHUD()
// return
// }
guard let vc = storyboard.instantiateViewController(identifier: "PlayerVC") as? PlayerVC else {
print("PlayerVC not found")
Utilities.dismissProgressHUD()
return
}
DispatchQueue.main.async {
let vc = self.vc.storyboard?.instantiateViewController(withIdentifier: "PlayerVC") as! PlayerVC
// DispatchQueue.main.async {
do {
// Ensure the liveStreamURL is valid
guard let liveStreamURL = URL(string: self.liveStreamURL) else {
@@ -254,6 +256,7 @@ class ThemeOneVM{
// Create a JWPlayerConfiguration
let config = try JWPlayerConfigurationBuilder()
.playlist(items: [item])
// .preload(JWPreload.none)
.autostart(true)
.build()
@@ -261,7 +264,8 @@ class ThemeOneVM{
vc.dismissTapped = self.tapped
vc.contentType = .liveStream
vc.modalPresentationStyle = .overFullScreen
Utilities.dismissProgressHUD()
// Present the PlayerVC
self.vc.present(vc, animated: false) {
self.stopLiveStream()
@@ -275,8 +279,7 @@ class ThemeOneVM{
}
// Dismiss the progress HUD after the view controller presentation
Utilities.dismissProgressHUD()
}
// }
}
func tapped(){