From cb5ab5c1df9dabc7b9bafec22fddb25bdcc5a865 Mon Sep 17 00:00:00 2001 From: Bilal Date: Thu, 11 Jul 2024 00:20:25 +0530 Subject: [PATCH] home commit --- WOKA/Constants K/StoryBoardID.swift | 1 + .../Karaoke/Controller/KaraokeDetailsVC.swift | 59 ++++++++++--------- .../Karaoke/Controller/KaraokeListingVC.swift | 1 + WOKA/Karaoke/ViewModel/KaraokeListingVM.swift | 3 +- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/WOKA/Constants K/StoryBoardID.swift b/WOKA/Constants K/StoryBoardID.swift index 4b5d46b..3954888 100644 --- a/WOKA/Constants K/StoryBoardID.swift +++ b/WOKA/Constants K/StoryBoardID.swift @@ -87,6 +87,7 @@ extension K{ static let karaokeListingVC = "KaraokeListingVC" static let karaokeDetailsVC = "KaraokeDetailsVC" static let jwKaraokePlayerVC = "JWKaraokePlayerVC" + static let aVPlayerVC = "AVPlayerVC" } } diff --git a/WOKA/Karaoke/Controller/KaraokeDetailsVC.swift b/WOKA/Karaoke/Controller/KaraokeDetailsVC.swift index d66a344..1b05a36 100644 --- a/WOKA/Karaoke/Controller/KaraokeDetailsVC.swift +++ b/WOKA/Karaoke/Controller/KaraokeDetailsVC.swift @@ -190,34 +190,37 @@ class KaraokeDetailsVC: UIViewController { guard let self else{return} Utilities.startProgressHUD() let sb = UIStoryboard(name: K.StoryBoard.Karaoke, bundle: nil) - let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.jwKaraokePlayerVC) as! JWKaraokePlayerVC - do { - - // Create a JWPlayerItem - let item = try JWPlayerItemBuilder() - .file(URL(string: itemBuild.url)!) - .posterImage(URL(string: itemBuild.poster ?? "")!) - .title(itemBuild.titles ?? "Karaoke") - .build() - - // Create a JWPlayerConfiguration - let config = try JWPlayerConfigurationBuilder() - .playlist(items: [item]) - .autostart(true) - .build() - - vc.config = config - // vc.dismissTapped = self.tapped - vc.modalPresentationStyle = .overFullScreen - vc.modalTransitionStyle = .crossDissolve - vc.documentAudioUrl = url - Utilities.dismissProgressHUD() - // Present the PlayerVC - self.present(vc, animated: true) - } catch { - print("Error creating JWPlayer configuration: \(error)") - Utilities.dismissProgressHUD() - } + let vc = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Karaoke.aVPlayerVC) as! AVPlayerVC + vc.videoURL = itemBuild.url + vc.modalPresentationStyle = .fullScreen + self.present(vc, animated: true) +// do { +// +// // Create a JWPlayerItem +// let item = try JWPlayerItemBuilder() +// .file(URL(string: itemBuild.url)!) +// .posterImage(URL(string: itemBuild.poster ?? "")!) +// .title(itemBuild.titles ?? "Karaoke") +// .build() +// +// // Create a JWPlayerConfiguration +// let config = try JWPlayerConfigurationBuilder() +// .playlist(items: [item]) +// .autostart(true) +// .build() +// +// vc.config = config +// // vc.dismissTapped = self.tapped +// vc.modalPresentationStyle = .overFullScreen +// vc.modalTransitionStyle = .crossDissolve +// vc.documentAudioUrl = url +// Utilities.dismissProgressHUD() +// // Present the PlayerVC +// self.present(vc, animated: true) +// } catch { +// print("Error creating JWPlayer configuration: \(error)") +// Utilities.dismissProgressHUD() +// } // Dismiss the progress HUD after the view controller presentation Utilities.dismissProgressHUD() diff --git a/WOKA/Karaoke/Controller/KaraokeListingVC.swift b/WOKA/Karaoke/Controller/KaraokeListingVC.swift index 1c98cb9..e7a55d2 100644 --- a/WOKA/Karaoke/Controller/KaraokeListingVC.swift +++ b/WOKA/Karaoke/Controller/KaraokeListingVC.swift @@ -159,6 +159,7 @@ extension KaraokeListingVC : TableViewSRC{ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if vm.karaokeListData.count == 0 {return} let data = vm.karaokeListData[indexPath.row] /* diff --git a/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift b/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift index 9b15503..987f4ed 100644 --- a/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift +++ b/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift @@ -138,7 +138,7 @@ class KaraokeListingVM{ self.vc.karaokeListingTableView.reloadData() self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 100 self.vc.karaokeListingTableView.layoutIfNeeded() - self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 200 + self.vc.tableHeight.constant = self.vc.karaokeListingTableView.contentSize.height + 10 if !isBtnClick{ self.headerData = self.karaokeListData.first @@ -154,6 +154,7 @@ class KaraokeListingVM{ // if not multiple of 10, means more data can be there, show more btn self.vc.loadMoreBtn.isHidden = false }else{ + self.stopFetch = true self.vc.loadMoreBtn.isHidden = true } default: