- Updated the play pause and record button usage, also added it to appear over all subviews.
- MAde dynamic name for saving in files with the current Timestamp in seconds - Added Icons for playhouse , also stopped other interactions while playing. - Added lazy loading to WebSeries watch_show_listing - Added Lazy loading to Games
This commit is contained in:
26
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/Contents.json
vendored
Normal file
26
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Pause.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "Pause@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "Pause@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
BIN
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/pause.png
vendored
Normal file
BIN
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/pause.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 560 B |
BIN
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/pause@2x.png
vendored
Normal file
BIN
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/pause@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/pause@3x.png
vendored
Normal file
BIN
WOKA/Assets/Assets.xcassets/Karaoke/KaraokePause.imageset/pause@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -31,7 +31,7 @@ class AudioBookDetailsVC : UIViewController{
|
||||
|
||||
var audioData : ListenAudioListingDM.AudioDatum?
|
||||
|
||||
var continueAudioData : ContinueAudioListDM.ResultData?
|
||||
var continueAudioData : ListenAudioListingDM.AudioDatum?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -73,7 +73,7 @@ class AudioBookHomeVC: UIViewController {
|
||||
}
|
||||
|
||||
@IBAction func listenAudioBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
let data = vm.audioListData[vm.indexToLoad]
|
||||
guard let data = vm.headerData else{return}
|
||||
var playerItems = [JwPlayerItemCreate]()
|
||||
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
||||
if let englishData = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first, let url = englishData.url{
|
||||
@@ -148,13 +148,13 @@ extension AudioBookHomeVC : TableViewSRC{
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
let data = vm.audioListData[indexPath.row]
|
||||
|
||||
/*
|
||||
Updated the top header data
|
||||
*/
|
||||
vm.indexToLoad = indexPath.row
|
||||
vm.setInitialData()
|
||||
|
||||
let data = vm.audioListData[indexPath.row]
|
||||
vm.headerData = data
|
||||
vm.setHeaderData()
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookDetailsVC) as! AudioBookDetailsVC
|
||||
@@ -187,11 +187,8 @@ extension AudioBookHomeVC : CollectionViewSRC{
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||
let data = vm.continueWatchingData[indexPath.row]
|
||||
|
||||
if let audioListIndex = vm.audioListData.firstIndex(where:{$0.id == data.id}){
|
||||
vm.indexToLoad = audioListIndex
|
||||
vm.setInitialData()
|
||||
}
|
||||
vm.headerData = data
|
||||
vm.setHeaderData()
|
||||
|
||||
let sb = UIStoryboard(name: K.StoryBoard.audioBooks, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.AudioBooks.audioBookDetailsVC) as! AudioBookDetailsVC
|
||||
|
||||
@@ -11,9 +11,12 @@ import Alamofire
|
||||
class AudioBookHomeVM{
|
||||
|
||||
weak var vc : AudioBookHomeVC!
|
||||
var continueWatchingData = [ContinueAudioListDM.ResultData]()
|
||||
var continueWatchingData = [ListenAudioListingDM.AudioDatum]()
|
||||
var audioListData = [ListenAudioListingDM.AudioDatum]()
|
||||
var indexToLoad = 0
|
||||
|
||||
var headerData : ListenAudioListingDM.AudioDatum?
|
||||
|
||||
// var indexToLoad = 0
|
||||
var pageNo = 0
|
||||
|
||||
func initView(){
|
||||
@@ -34,21 +37,21 @@ class AudioBookHomeVM{
|
||||
self.vc.tableHeight.constant = self.vc.audioListingTableView.contentSize.height
|
||||
}
|
||||
|
||||
func setInitialData(){
|
||||
func setHeaderData(){
|
||||
// if indexToLoad > continueWatchingData.count {
|
||||
// return
|
||||
// }
|
||||
let data = audioListData[indexToLoad]
|
||||
guard let headerData else{return}
|
||||
|
||||
if let url = data.thumbnailPath{
|
||||
if let url = headerData.thumbnailPath{
|
||||
self.vc.headerImage.imageURL(url, color: .white)
|
||||
}
|
||||
|
||||
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
||||
let englishData = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first
|
||||
let englishData = headerData.contentMoreDetails?.filter({$0.languageMasterID == 1}).first
|
||||
vc.headerTitleLabel.text = englishData?.title
|
||||
}else{
|
||||
let hindiData = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first
|
||||
let hindiData = headerData.contentMoreDetails?.filter({$0.languageMasterID == 2}).first
|
||||
vc.headerTitleLabel.text = hindiData?.title
|
||||
}
|
||||
}
|
||||
@@ -109,7 +112,7 @@ class AudioBookHomeVM{
|
||||
}
|
||||
}
|
||||
|
||||
func getShowListing(){
|
||||
func getShowListing(isBtnClick : Bool = false){
|
||||
// Utilities.startProgressHUD()
|
||||
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
|
||||
let params : Parameters = ["api_version" : "v2",
|
||||
@@ -137,8 +140,10 @@ class AudioBookHomeVM{
|
||||
self.vc.tableHeight.constant = self.vc.audioListingTableView.contentSize.height + 100
|
||||
self.vc.audioListingTableView.layoutIfNeeded()
|
||||
self.vc.tableHeight.constant = self.vc.audioListingTableView.contentSize.height
|
||||
self.indexToLoad = 0
|
||||
self.setInitialData()
|
||||
if !isBtnClick{
|
||||
self.headerData = self.audioListData.first
|
||||
self.setHeaderData()
|
||||
}
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
|
||||
@@ -32,7 +32,7 @@ class ContinueAudioCell: UICollectionViewCell {
|
||||
shimmerView.stopShimmer()
|
||||
}
|
||||
|
||||
func setAudioData(data: ContinueAudioListDM.ResultData){
|
||||
func setAudioData(data: ListenAudioListingDM.AudioDatum){
|
||||
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
|
||||
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
|
||||
audioBookTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
|
||||
|
||||
@@ -9,7 +9,7 @@ import Foundation
|
||||
|
||||
// MARK: - ContinueAudioListDM
|
||||
struct ContinueAudioListDM: Codable {
|
||||
let result: [ResultData]?
|
||||
let result: [ListenAudioListingDM.AudioDatum]?
|
||||
let totalRecords: Int?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
|
||||
@@ -28,7 +28,7 @@ struct ListenAudioListingDM: Codable {
|
||||
let languageMasterID: Int?
|
||||
let genderMasterID, audioDuration, mediaID: String?
|
||||
let contentMoreDetails: [ContentMoreDetail]?
|
||||
// let userVideoView: [JSONAny]?
|
||||
let userVideoView: [UserVideoView]?
|
||||
let categoryData: [CategoryDatum]?
|
||||
// let ageRangeData, genderData: [JSONAny]?
|
||||
var markAsFavourite, isLiked: Bool?
|
||||
@@ -47,7 +47,7 @@ struct ListenAudioListingDM: Codable {
|
||||
case audioDuration = "audio_duration"
|
||||
case mediaID = "media_id"
|
||||
case contentMoreDetails = "content_more_details"
|
||||
// case userVideoView = "user_video_view"
|
||||
case userVideoView = "user_video_view"
|
||||
// case ageRangeData = "age_range_data"
|
||||
// case genderData = "gender_data"
|
||||
case categoryData = "category_data"
|
||||
@@ -59,6 +59,23 @@ struct ListenAudioListingDM: Codable {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - UserVideoView
|
||||
struct UserVideoView: Codable {
|
||||
let id, userID, postID, postType: Int?
|
||||
let totalWatchedDuration, lastWatchedLeft: String?
|
||||
let categoryID: Int?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case userID = "user_id"
|
||||
case postID = "post_id"
|
||||
case postType = "post_type"
|
||||
case totalWatchedDuration = "total_watched_duration"
|
||||
case lastWatchedLeft = "last_watched_left"
|
||||
case categoryID = "category_id"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CategoryDatum
|
||||
struct CategoryDatum: Codable {
|
||||
let id: Int?
|
||||
@@ -90,58 +107,4 @@ struct ListenAudioListingDM: Codable {
|
||||
case tagsKeywords = "tags_keywords"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//{
|
||||
// "id": 6,
|
||||
// "title": "DADAGIRI KI AISI KI TAISE",
|
||||
// "description": "<p>Kalu and Chitta are the two big bullies of the school who don't stop at troubling anyone. They steal someone's food and bully someone. ADI and his friends can't take it all. They go to seek help from the wise sage, Piku Baba. What clever method did Piku Baba tell Kalu and Chitta to teach them a lesson? Has Kalu and Chitta's bullying come to an end? Can ADI and his crew stop them? Listen to this funny story to find out.</p>",
|
||||
// "thumbnail_path": "https://wokaland.com/admin/storage/app/public/uploads/Listen/64b2bdf9d277d.png?d=1719904091",
|
||||
// "audio_url": "https://content.jwplatform.com/videos/tUJ8m9W0-Ysj2G4DQ.mp4",
|
||||
// "category_master_id": "11",
|
||||
// "age_range_master_id": "0",
|
||||
// "tags_keyword": "0",
|
||||
// "release_date": "2023-07-15 00:00:00",
|
||||
// "language_master_id": 1,
|
||||
// "gender_master_id": "0",
|
||||
// "audio_duration": "00:07:25",
|
||||
// "media_id": "",
|
||||
// "content_more_details": [
|
||||
// {
|
||||
// "id": 831,
|
||||
// "content_id": 6,
|
||||
// "post_type": 7,
|
||||
// "language_master_id": 1,
|
||||
// "title": "DADAGIRI KI AISI KI TAISE",
|
||||
// "description": "<p>Kalu and Chitta are the two big bullies of the school who don't stop at troubling anyone. They steal someone's food and bully someone. ADI and his friends can't take it all. They go to seek help from the wise sage, Piku Baba. What clever method did Piku Baba tell Kalu and Chitta to teach them a lesson? Has Kalu and Chitta's bullying come to an end? Can ADI and his crew stop them? Listen to this funny story to find out.</p>",
|
||||
// "url": "https://content.jwplatform.com/videos/tUJ8m9W0-Ysj2G4DQ.mp4",
|
||||
// "tags_keywords": "0"
|
||||
// },
|
||||
// {
|
||||
// "id": 832,
|
||||
// "content_id": 6,
|
||||
// "post_type": 7,
|
||||
// "language_master_id": 2,
|
||||
// "title": "दादागिरी की ऐसी की तैसी",
|
||||
// "description": "<p>कालू और चिट्टा स्कूल के दो बड़े बदमाश हैं जो किसी को भी सताने से बाज़ नहीं आते। किसी का वे खाना चुरा लेते हैं और किसी के ऊपर दादागिरी जमाते रहते हैं। आदि और उसके दोस्त यह सब सहन नहीं कर पा रहे हैं। वे ज्ञानी साधु, पीकू बाबा से मदद माँगने जाते हैं। कालू और चिट्ठा को सबक सिखानेके लिए। पीकू बाबा ने उन्हें कौन सा खुफिया तरीका बताया? क्या कालू और चिट्टा की दादागिरी ख़त्म हुई? क्या आदि और उसका दल उन्हें रोक पाते हैं? पता लगाने के लिए यह मज़ेदार कहानी सुनो।</p>",
|
||||
// "url": "https://content.jwplatform.com/videos/tUJ8m9W0-Ysj2G4DQ.mp4",
|
||||
// "tags_keywords": "0"
|
||||
// }
|
||||
// ],
|
||||
// "user_video_view": [],
|
||||
// "category_data": [
|
||||
// {
|
||||
// "id": 11,
|
||||
// "category_name": "Audio"
|
||||
// }
|
||||
// ],
|
||||
// "age_range_data": [],
|
||||
// "gender_data": [],
|
||||
// "mark_as_favourite": false,
|
||||
// "is_liked": false,
|
||||
// "views_count": 4763,
|
||||
// "likes_count": 20,
|
||||
// "bookmark_count": 15
|
||||
// }
|
||||
|
||||
@@ -18,6 +18,9 @@ class GamesListVC: UIViewController {
|
||||
@IBOutlet weak var headerTitleLabel: UILabel!
|
||||
@IBOutlet weak var gamesLoadingView: ShimmerEffectView!
|
||||
|
||||
@IBOutlet weak var loadMoreBtn: LocalisedElementsButton!
|
||||
@IBOutlet weak var loadMoreActivityIndicator: UIActivityIndicatorView!
|
||||
|
||||
var vm = GamesListVM()
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -51,6 +54,8 @@ class GamesListVC: UIViewController {
|
||||
vm.updateTableHeight()
|
||||
}
|
||||
|
||||
// MARK: - Tap Handler
|
||||
|
||||
@IBAction func gameBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
let sb = UIStoryboard(name: K.StoryBoard.Games, bundle: nil)
|
||||
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Games.gamesWebViewVC) as! GamesWebViewVC
|
||||
@@ -62,6 +67,13 @@ class GamesListVC: UIViewController {
|
||||
vcPush.modalPresentationStyle = .fullScreen
|
||||
self.present(vcPush, animated: true)
|
||||
}
|
||||
|
||||
@IBAction func loadMoreBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
loadMoreBtn.isHidden = true
|
||||
vm.pageNo += 1
|
||||
loadMoreActivityIndicator.startAnimating()
|
||||
vm.getGamesListing(isBtnClick: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TableView DataSource , Delegates
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<rect key="frame" x="0.0" y="116" width="414" height="532"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="KYp-fS-yk4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="55"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="120"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="HAVE A FUN TIME" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MGh-K4-gtY" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="10" y="0.0" width="394" height="40"/>
|
||||
@@ -117,6 +117,48 @@
|
||||
<constraint firstAttribute="height" id="DJl-l2-EKl"/>
|
||||
</constraints>
|
||||
</tableView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9Mm-aO-TTm">
|
||||
<rect key="frame" x="10" y="70" width="394" height="50"/>
|
||||
<subviews>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="84a-EX-VYD" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="119.5" y="0.0" width="155" height="50"/>
|
||||
<color key="backgroundColor" red="0.36862745099999999" green="0.1215686275" blue="0.76862745099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="155" id="447-he-qgr"/>
|
||||
<constraint firstAttribute="height" constant="50" id="KTi-o8-Dme"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<inset key="imageEdgeInsets" minX="-10" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
<state key="normal" title="LOAD MORE"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="loadMoreBtnTapped:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="S3u-Ci-UcJ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="ulX-KY-9er">
|
||||
<rect key="frame" x="172" y="0.0" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="ulX-KY-9er" secondAttribute="height" multiplier="1:1" id="ZUq-66-WVN"/>
|
||||
</constraints>
|
||||
<color key="color" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="84a-EX-VYD" firstAttribute="top" secondItem="9Mm-aO-TTm" secondAttribute="top" id="1fO-tP-VXK"/>
|
||||
<constraint firstItem="ulX-KY-9er" firstAttribute="centerX" secondItem="9Mm-aO-TTm" secondAttribute="centerX" id="HRx-A5-AzB"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ulX-KY-9er" secondAttribute="bottom" id="U6U-gO-JQh"/>
|
||||
<constraint firstItem="ulX-KY-9er" firstAttribute="top" secondItem="9Mm-aO-TTm" secondAttribute="top" id="WeX-CY-opT"/>
|
||||
<constraint firstAttribute="bottom" secondItem="84a-EX-VYD" secondAttribute="bottom" id="d3V-th-lSH"/>
|
||||
<constraint firstItem="84a-EX-VYD" firstAttribute="centerX" secondItem="9Mm-aO-TTm" secondAttribute="centerX" id="jHU-f4-tvs"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
|
||||
</stackView>
|
||||
@@ -154,6 +196,8 @@
|
||||
<outlet property="headerImage" destination="Kgv-cB-NPV" id="HPo-R5-rj0"/>
|
||||
<outlet property="headerTitleLabel" destination="7BL-Zy-PFm" id="kro-hg-bg7"/>
|
||||
<outlet property="headerView" destination="mer-q0-6Vp" id="Ni3-qe-8Ud"/>
|
||||
<outlet property="loadMoreActivityIndicator" destination="ulX-KY-9er" id="jGf-y1-HQw"/>
|
||||
<outlet property="loadMoreBtn" destination="84a-EX-VYD" id="xRs-D4-3hc"/>
|
||||
<outlet property="scrollView" destination="Jyq-DW-OZz" id="1eX-0n-4I1"/>
|
||||
<outlet property="tableHeight" destination="DJl-l2-EKl" id="5Fi-db-TJJ"/>
|
||||
</connections>
|
||||
|
||||
@@ -14,6 +14,9 @@ class GamesListVM{
|
||||
var gameData = [GamesListDM.GameDatum]()
|
||||
var indexToLoad = 0
|
||||
|
||||
var pageNo = 0
|
||||
var stopFetch = false
|
||||
|
||||
func initView(){
|
||||
setupCell()
|
||||
let color1 = #colorLiteral(red: 0.8, green: 0.6078431373, blue: 0.1098039216, alpha: 1)
|
||||
@@ -63,9 +66,13 @@ class GamesListVM{
|
||||
|
||||
// MARK: - Get Games Data
|
||||
|
||||
func getGamesListing(){
|
||||
func getGamesListing(isBtnClick : Bool = false){
|
||||
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Games.game_listing, method: .post,headers: headers) { [weak self](result : Result<BaseResponseModel<GamesListDM>, NetworkManager.APIError>) in
|
||||
let params : Parameters = ["api_version" : "v2",
|
||||
"start" : pageNo,
|
||||
"limit": 5]
|
||||
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Games.game_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result<BaseResponseModel<GamesListDM>, NetworkManager.APIError>) in
|
||||
switch result{
|
||||
case .success(let data):
|
||||
guard let self else{
|
||||
@@ -78,18 +85,34 @@ class GamesListVM{
|
||||
Error
|
||||
*/
|
||||
Utilities.dismissProgressHUD()
|
||||
vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
|
||||
// vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
|
||||
case 1:
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.gameData else{return}
|
||||
self.gameData.removeAll()
|
||||
self.gameData = data
|
||||
self.gameData.append(contentsOf: data)
|
||||
self.vc.gamesListingTableView.reloadData()
|
||||
self.vc.tableHeight.constant = self.vc.gamesListingTableView.contentSize.height + 100
|
||||
self.vc.gamesListingTableView.layoutIfNeeded()
|
||||
self.vc.tableHeight.constant = self.vc.gamesListingTableView.contentSize.height
|
||||
self.setHeaderData()
|
||||
|
||||
if !isBtnClick{
|
||||
setHeaderData()
|
||||
}
|
||||
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
|
||||
|
||||
if self.gameData.count.isMultiple(of: 5) && !self.stopFetch{
|
||||
// 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:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ class JWKaraokePlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate
|
||||
//Disable Picture in Picture
|
||||
playerView.allowsPictureInPicturePlayback = false
|
||||
playerView.captionStyle = .none
|
||||
|
||||
self.view.bringSubviewToFront(outerStack)
|
||||
self.view.bringSubviewToFront(backButton)
|
||||
setupKaraoke()
|
||||
@@ -96,7 +95,6 @@ class JWKaraokePlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate
|
||||
self.interfaceBehavior = .hidden
|
||||
guard let audioRecorder = audioRecorder else { return }
|
||||
audioRecorder.record()
|
||||
|
||||
}
|
||||
|
||||
func stopRecording() {
|
||||
@@ -146,11 +144,11 @@ class JWKaraokePlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate
|
||||
|
||||
// Export the mixed audio
|
||||
let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
|
||||
let filePath = documentsDirectory.appendingPathComponent("mixedAudio.m4a")
|
||||
let fileName = "\((self.videoTitle?.replacingOccurrences(of: " ", with: "").replacingOccurrences(of: ".", with: "") ?? "Audio") + Date().timeIntervalSince1970.toString()).m4a"
|
||||
let filePath = documentsDirectory.appendingPathComponent(fileName)
|
||||
deleteFileIfExist(at: filePath)
|
||||
|
||||
mixedAudioURL = filePath
|
||||
// mixedAudioURL = documentsDirectory.appendingPathComponent("mixedAudio.m4a")
|
||||
|
||||
guard let exportSession = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetAppleM4A) else { return }
|
||||
exportSession.outputURL = mixedAudioURL
|
||||
@@ -162,6 +160,7 @@ class JWKaraokePlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate
|
||||
Utilities.dismissProgressHUD()
|
||||
DispatchQueue.main.async {
|
||||
self.playBtn.isEnabled = true
|
||||
self.downloadRecordingBtn.isEnabled = true
|
||||
}
|
||||
|
||||
|
||||
@@ -304,12 +303,21 @@ class JWKaraokePlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate
|
||||
@IBAction func playBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
if !isPlaying {
|
||||
playMixedAudio()
|
||||
self.interfaceBehavior = .normal
|
||||
self.interfaceBehavior = .hidden
|
||||
sender.setTitle("Pause", for: .normal)
|
||||
sender.setImage(UIImage(named: "KaraokePause"), for: .normal)
|
||||
|
||||
// Disable Recording while playing, hide controls for jwplayer
|
||||
self.interfaceBehavior = .hidden
|
||||
self.startRecordBtn.isEnabled = false
|
||||
self.downloadRecordingBtn.isEnabled = false
|
||||
} else {
|
||||
self.interfaceBehavior = .normal
|
||||
sender.setTitle("Play", for: .normal)
|
||||
sender.setImage(UIImage(named: "PlayButtonSmall"), for: .normal)
|
||||
|
||||
// Disable Recording while playing, hide controls for jwplayer
|
||||
self.interfaceBehavior = .normal
|
||||
self.startRecordBtn.isEnabled = true
|
||||
self.downloadRecordingBtn.isEnabled = true
|
||||
}
|
||||
|
||||
isPlaying.toggle()
|
||||
@@ -317,36 +325,55 @@ class JWKaraokePlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate
|
||||
self.player.pause()
|
||||
print("Play")
|
||||
}
|
||||
|
||||
func playMixedAudio() {
|
||||
guard let mixedAudioURL = mixedAudioURL else { return }
|
||||
|
||||
do {
|
||||
|
||||
let documentsDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
|
||||
|
||||
do {
|
||||
let documentsDirectoryURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
|
||||
let destinationURL = documentsDirectoryURL.appendingPathComponent("xyze.m4a")
|
||||
|
||||
do {
|
||||
|
||||
try FileManager.default.copyItem(at: mixedAudioURL, to: destinationURL)
|
||||
|
||||
} catch
|
||||
let error as NSError { print(error.localizedDescription)}
|
||||
|
||||
// Check if file already exists
|
||||
if FileManager.default.fileExists(atPath: destinationURL.path) {
|
||||
// Delete the existing file
|
||||
try FileManager.default.removeItem(at: destinationURL)
|
||||
}
|
||||
|
||||
// Copy the new file
|
||||
try FileManager.default.copyItem(at: mixedAudioURL, to: destinationURL)
|
||||
|
||||
// Play the audio
|
||||
let playerKAraoke = AVPlayer(url: destinationURL)
|
||||
|
||||
// Adding a completion handler to check if the player starts playing
|
||||
let playerObserver = playerKAraoke.addPeriodicTimeObserver(forInterval: CMTime(seconds: 1, preferredTimescale: 1), queue: .main) { time in
|
||||
print("Playing audio at time: \(time.seconds)")
|
||||
}
|
||||
|
||||
// Observing when playback finishes
|
||||
NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: playerKAraoke.currentItem, queue: .main) { _ in
|
||||
print("Audio finished playing")
|
||||
// Remove observer
|
||||
playerKAraoke.removeTimeObserver(playerObserver)
|
||||
}
|
||||
|
||||
playerKAraoke.volume = 1.0
|
||||
playerKAraoke.play()
|
||||
print("Audio is playing...")
|
||||
// Uncomment this block if you need to configure the audio session and play using AVAudioPlayer
|
||||
/*
|
||||
// Configure the audio session
|
||||
let audioSession = AVAudioSession.sharedInstance()
|
||||
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.defaultToSpeaker])
|
||||
try audioSession.setActive(true)
|
||||
|
||||
let audioPlayer = try AVAudioPlayer(contentsOf: mixedAudioURL)
|
||||
audioPlayer.volume = 1.0
|
||||
audioPlayer.play()
|
||||
*/
|
||||
|
||||
// // Configure the audio session
|
||||
// let audioSession = AVAudioSession.sharedInstance()
|
||||
// try audioSession.setCategory(.playAndRecord, mode: .default, options: [.defaultToSpeaker])
|
||||
// try audioSession.setActive(true)
|
||||
//
|
||||
// let audioPlayer = try AVAudioPlayer(contentsOf: mixedAudioURL)
|
||||
// audioPlayer.volume = 1.0
|
||||
// audioPlayer.play()
|
||||
} catch {
|
||||
print("Error playing mixed audio: \(error.localizedDescription)")
|
||||
print("Error: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -833,7 +833,7 @@
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="k45-7s-jnN" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="k45-7s-jnN" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="65" width="364" height="21"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="16"/>
|
||||
@@ -1128,7 +1128,7 @@
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemRedColor">
|
||||
<color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -117,6 +117,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
|
||||
player.play()
|
||||
case .continueWatching,.audioBooks, .games:
|
||||
player.seek(to: 0)
|
||||
player.play()
|
||||
// player.play()
|
||||
case nil:
|
||||
break
|
||||
|
||||
@@ -34,6 +34,9 @@ class WebSeriesVC: UIViewController {
|
||||
|
||||
@IBOutlet weak var continueWatchingStack: UIStackView!
|
||||
|
||||
@IBOutlet weak var loadMoreBtn: LocalisedElementsButton!
|
||||
@IBOutlet weak var loadMoreActivityIndicator: UIActivityIndicatorView!
|
||||
|
||||
var vm = WebSeriesVM()
|
||||
|
||||
override func viewDidLoad() {
|
||||
@@ -79,6 +82,12 @@ class WebSeriesVC: UIViewController {
|
||||
self.expandBtn.setImage(UIImage(named: "SupportUpArrow"), for: .normal)
|
||||
}
|
||||
|
||||
@IBAction func loadMoreBtnTapped(_ sender: LocalisedElementsButton) {
|
||||
loadMoreBtn.isHidden = true
|
||||
vm.pageNo += 1
|
||||
loadMoreActivityIndicator.startAnimating()
|
||||
vm.getShowListing(categoryID: 18, isBtnClick: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TableView DataSource , Delegates
|
||||
|
||||
@@ -103,15 +103,26 @@ class JWPlayerManager {
|
||||
return
|
||||
}
|
||||
|
||||
// Create a JWPlayerConfiguration with the playlist
|
||||
let config = try JWPlayerConfigurationBuilder()
|
||||
.playlist(items: items)
|
||||
.autostart(false)
|
||||
.build()
|
||||
let finalConfig : JWPlayerConfiguration?
|
||||
|
||||
switch contentType{
|
||||
case .audioBooks:
|
||||
finalConfig = try JWPlayerConfigurationBuilder()
|
||||
.playlist(items: items)
|
||||
.autostart(true)
|
||||
.build()
|
||||
default:
|
||||
// Create a JWPlayerConfiguration with the playlist
|
||||
finalConfig = try JWPlayerConfigurationBuilder()
|
||||
.playlist(items: items)
|
||||
.autostart(false)
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
playerVC.videoIndex = startIndex
|
||||
playerVC.contentType = contentType
|
||||
playerVC.config = config
|
||||
playerVC.config = finalConfig
|
||||
playerVC.modalPresentationStyle = .overFullScreen
|
||||
|
||||
// Present the PlayerVC
|
||||
|
||||
@@ -31,7 +31,7 @@ class WebSeriesEpisodeCell: UITableViewCell {
|
||||
|
||||
func setData(data : SeasonEpisodeListingDM.EpisodeDatum){
|
||||
if let url = data.thumbnailPath{
|
||||
self.seasonImage.imageURL(url, color: UIColor.appColor(.TextDarkBlue)!)
|
||||
self.seasonImage.imageURL(url, color: .black)
|
||||
}
|
||||
|
||||
self.seasonTime.text = data.episodeDuration ?? "0:00:00"
|
||||
@@ -45,7 +45,7 @@ class WebSeriesEpisodeCell: UITableViewCell {
|
||||
|
||||
func setTeaserData(data : TeaserDM.ResultData){
|
||||
if let url = data.thumbnailPath{
|
||||
self.seasonImage.imageURL(url, color: UIColor.appColor(.TextDarkBlue)!)
|
||||
self.seasonImage.imageURL(url, color: .black)
|
||||
}
|
||||
|
||||
self.seasonTime.text = data.teaserDuration ?? "0:00:00"
|
||||
|
||||
@@ -21,6 +21,8 @@ class WebSeriesVM{
|
||||
|
||||
//Static url for masila
|
||||
var masilaUrl = "https://content.jwplatform.com/videos/Iygt11AD-Ysj2G4DQ.mp4"
|
||||
var pageNo = 0
|
||||
var stopFetch = false
|
||||
|
||||
func initView(){
|
||||
setupCell()
|
||||
@@ -157,10 +159,13 @@ class WebSeriesVM{
|
||||
}
|
||||
}
|
||||
|
||||
func getShowListing(categoryID : Int){
|
||||
func getShowListing(categoryID : Int, isBtnClick : Bool = false){
|
||||
// Utilities.startProgressHUD()
|
||||
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
|
||||
let params : Parameters = ["category_id" : categoryID] // from category listing api , default will be 1
|
||||
let params : Parameters = ["category_id" : categoryID,
|
||||
"api_version" : "v2",
|
||||
"start" : pageNo,
|
||||
"limit": 10] // from category listing api , default will be 1
|
||||
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.WebSeries.watch_show_listing, method: .post,parameters: params,headers: headers) { [weak self](result : Result<BaseResponseModel<WebSeriesShowListDM>, NetworkManager.APIError>) in
|
||||
switch result{
|
||||
case .success(let data):
|
||||
@@ -178,14 +183,24 @@ class WebSeriesVM{
|
||||
case 1:
|
||||
Utilities.dismissProgressHUD()
|
||||
guard let data = data.data?.showData else{return}
|
||||
self.showData.removeAll()
|
||||
self.showData = data
|
||||
self.showData.append(contentsOf: data)
|
||||
self.vc.showListingTableView.reloadData()
|
||||
self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height + 100
|
||||
self.vc.showListingTableView.layoutIfNeeded()
|
||||
self.vc.tableHeight.constant = self.vc.showListingTableView.contentSize.height
|
||||
|
||||
self.stopShimmer()
|
||||
|
||||
self.vc.loadMoreActivityIndicator.stopAnimating()
|
||||
self.vc.loadMoreActivityIndicator.hidesWhenStopped = true
|
||||
|
||||
if self.showData.count.isMultiple(of: 10) && !self.stopFetch{
|
||||
// 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:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<rect key="frame" x="0.0" y="116" width="393" height="477"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="c6v-VU-iKP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="105"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="170"/>
|
||||
<subviews>
|
||||
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="mFz-UO-YUA">
|
||||
<rect key="frame" x="10" y="-270" width="373" height="270"/>
|
||||
@@ -205,6 +205,48 @@
|
||||
<constraint firstAttribute="height" id="WLI-rz-zRP"/>
|
||||
</constraints>
|
||||
</tableView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uJQ-Z1-n44">
|
||||
<rect key="frame" x="10" y="120" width="373" height="50"/>
|
||||
<subviews>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7ol-RU-bwy" customClass="LocalisedElementsButton" customModule="WOKA" customModuleProvider="target">
|
||||
<rect key="frame" x="109" y="0.0" width="155" height="50"/>
|
||||
<color key="backgroundColor" red="0.36862745099999999" green="0.1215686275" blue="0.76862745099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="155" id="T89-an-q4g"/>
|
||||
<constraint firstAttribute="height" constant="50" id="aPy-dy-Xxq"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="titleEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<inset key="imageEdgeInsets" minX="-10" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
<state key="normal" title="LOAD MORE"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<integer key="value" value="25"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="loadMoreBtnTapped:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="YrG-sY-XXq"/>
|
||||
</connections>
|
||||
</button>
|
||||
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="eOC-qb-KNO">
|
||||
<rect key="frame" x="161.66666666666666" y="0.0" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="eOC-qb-KNO" secondAttribute="height" multiplier="1:1" id="bFH-MC-10o"/>
|
||||
</constraints>
|
||||
<color key="color" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="7ol-RU-bwy" firstAttribute="top" secondItem="uJQ-Z1-n44" secondAttribute="top" id="1yB-bD-RQb"/>
|
||||
<constraint firstItem="7ol-RU-bwy" firstAttribute="centerX" secondItem="uJQ-Z1-n44" secondAttribute="centerX" id="53s-T0-e7M"/>
|
||||
<constraint firstAttribute="bottom" secondItem="7ol-RU-bwy" secondAttribute="bottom" id="67l-gg-0nz"/>
|
||||
<constraint firstItem="eOC-qb-KNO" firstAttribute="top" secondItem="uJQ-Z1-n44" secondAttribute="top" id="Hap-dx-ulP"/>
|
||||
<constraint firstItem="eOC-qb-KNO" firstAttribute="centerX" secondItem="uJQ-Z1-n44" secondAttribute="centerX" id="o0q-8i-Nfa"/>
|
||||
<constraint firstAttribute="bottom" secondItem="eOC-qb-KNO" secondAttribute="bottom" id="poC-B3-ai9"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<edgeInsets key="layoutMargins" top="0.0" left="10" bottom="0.0" right="10"/>
|
||||
</stackView>
|
||||
@@ -244,6 +286,8 @@
|
||||
<outlet property="headerViewTopConstraint" destination="qkp-BT-BFx" id="5E7-T8-qUm"/>
|
||||
<outlet property="languageLabel" destination="Exa-2W-66W" id="e7q-aD-laV"/>
|
||||
<outlet property="languageStack" destination="yFH-vA-sul" id="pBj-Ph-i57"/>
|
||||
<outlet property="loadMoreActivityIndicator" destination="eOC-qb-KNO" id="wjE-aj-J2d"/>
|
||||
<outlet property="loadMoreBtn" destination="7ol-RU-bwy" id="slu-Zm-hE1"/>
|
||||
<outlet property="masilaTrailerView" destination="Cog-DZ-ib0" id="IMd-wS-yNh"/>
|
||||
<outlet property="scrollView" destination="rom-H6-7RC" id="8bD-vg-lG2"/>
|
||||
<outlet property="showListingTableView" destination="Oxv-4e-Qj0" id="Yye-0B-zRg"/>
|
||||
|
||||
Reference in New Issue
Block a user