Merge remote-tracking branch 'refs/remotes/origin/woka_dev'

This commit is contained in:
2024-07-22 20:07:22 +05:30
17 changed files with 240 additions and 124 deletions

View File

@@ -27,6 +27,9 @@ class AudioBookDetailsVC : UIViewController{
@IBOutlet weak var shareView: UIView!
@IBOutlet weak var likeView: UIView!
@IBOutlet weak var outerView: UIView!
@IBOutlet weak var contentView: UIView!
var delegate : ReloadAudioBooksFavLike?
var audioData : ListenAudioListingDM.AudioDatum?
@@ -44,7 +47,17 @@ class AudioBookDetailsVC : UIViewController{
tapHandler()
}
@objc func handleTap(_ gesture: UITapGestureRecognizer) {
let location = gesture.location(in: outerView)
if !contentView.frame.contains(location) {
self.dismiss(animated: true)
}
}
func tapHandler(){
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
outerView.addGestureRecognizer(tapGesture)
addView.addTapGesture { [weak self] in
guard let self else{return}
if AuthFunc.shareInstance.guestUserLoginPopUp() { return}

View File

@@ -20,6 +20,7 @@ class AudioBookHomeVM{
var pageNo = 0
func initView(){
vc.scrollView.indicatorStyle = .white // or .white
startShimmer()
setupCell()
getContinueWatching()

View File

@@ -548,9 +548,11 @@
<outlet property="addIcon" destination="2yk-zl-Q9j" id="Hzs-4j-JMo"/>
<outlet property="addLabel" destination="LQ3-mK-dvo" id="4in-Gm-TnD"/>
<outlet property="addView" destination="zzP-3H-SbJ" id="4cf-XU-HCu"/>
<outlet property="contentView" destination="83Y-DW-IDx" id="m2F-kW-PKP"/>
<outlet property="likeIcon" destination="BFc-Fk-JaV" id="KAL-RG-C03"/>
<outlet property="likeLabel" destination="YWt-as-0Xx" id="Cad-AG-bQa"/>
<outlet property="likeView" destination="cDf-0R-9gk" id="RkQ-Vv-Cdh"/>
<outlet property="outerView" destination="Jeb-h3-DAu" id="YGf-mu-3MT"/>
<outlet property="shareView" destination="JnW-oE-1M6" id="Cf0-US-B2t"/>
<outlet property="totalLikes" destination="PZ4-mv-7WT" id="YzN-4f-ePX"/>
<outlet property="watchingDesc" destination="45x-AZ-MpL" id="HFF-fb-klz"/>

View File

@@ -31,7 +31,7 @@
<rect key="frame" x="0.0" y="0.0" width="365" height="235"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="uLp-jK-t8S">
<rect key="frame" x="10" y="64" width="345" height="98.999999999999972"/>
<rect key="frame" x="10" y="64" width="345" height="99"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
@@ -39,20 +39,20 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="equalSpacing" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="iZA-rX-eSc" userLabel="TitleLikeFav">
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="fillProportionally" alignment="center" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="iZA-rX-eSc" userLabel="TitleLikeFav">
<rect key="frame" x="10" y="166" width="345" height="35"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tuK-jV-nee">
<rect key="frame" x="0.0" y="7.9999999999999982" width="41.666666666666664" height="19.333333333333329"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="asdasdasdsadsadsadsadsadsadsadsad" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tuK-jV-nee">
<rect key="frame" x="0.0" y="7.9999999999999982" width="259.66666666666669" height="19.333333333333329"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="16"/>
<color key="textColor" name="ImageDarkBlue"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="KgU-Gz-jLc">
<rect key="frame" x="264" y="0.0" width="81" height="35"/>
<rect key="frame" x="261.66666666666669" y="0.0" width="83.333333333333314" height="35"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ewL-vm-Zuj">
<rect key="frame" x="0.0" y="0.0" width="42" height="35"/>
<rect key="frame" x="0.0" y="0.0" width="44.333333333333336" height="35"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jbW-4o-QTH">
<rect key="frame" x="0.0" y="0.0" width="35" height="35"/>
@@ -67,7 +67,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1TM-ln-NlS">
<rect key="frame" x="35" y="0.0" width="7" height="35"/>
<rect key="frame" x="35" y="0.0" width="9.3333333333333357" height="35"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="16"/>
<color key="textColor" name="ImageDarkBlue"/>
<nil key="highlightedColor"/>
@@ -75,7 +75,7 @@
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxM-qE-KNp">
<rect key="frame" x="46" y="0.0" width="35" height="35"/>
<rect key="frame" x="48.333333333333314" y="0.0" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" secondItem="qxM-qE-KNp" secondAttribute="height" multiplier="1:1" id="W2A-yZ-Fxg"/>
</constraints>

View File

@@ -23,6 +23,9 @@ class GamesDetailVC: UIViewController {
@IBOutlet weak var shareView: UIView!
@IBOutlet weak var likeView: UIView!
@IBOutlet weak var outerView: UIView!
@IBOutlet weak var contentView: UIView!
var gameData : GamesListDM.GameDatum?
var delegate : ReloadSeriesFavLike?
var gameIndex = 0
@@ -31,9 +34,20 @@ class GamesDetailVC: UIViewController {
super.viewDidLoad()
initView()
tapHandler()
}
@objc func handleTap(_ gesture: UITapGestureRecognizer) {
let location = gesture.location(in: outerView)
if !contentView.frame.contains(location) {
self.dismiss(animated: true)
}
}
func initView(){
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
outerView.addGestureRecognizer(tapGesture)
if let gameData{
if let url = gameData.thumbnailPath{
watchingImage.imageURL(url, color: .white)

View File

@@ -510,9 +510,11 @@
<outlet property="addIcon" destination="Cxh-9y-gke" id="yB8-CP-yfU"/>
<outlet property="addLabel" destination="1Fv-F8-Ru7" id="gjZ-gM-JFH"/>
<outlet property="addView" destination="DaB-GB-ixm" id="Fid-Fh-KZt"/>
<outlet property="contentView" destination="Ucy-1t-PiR" id="BwJ-fm-sqm"/>
<outlet property="likeIcon" destination="eVc-5U-A21" id="G3L-AP-bKQ"/>
<outlet property="likeLabel" destination="y0P-dN-8KQ" id="Mea-GN-npi"/>
<outlet property="likeView" destination="oeh-Ro-EPx" id="q5F-KK-n2E"/>
<outlet property="outerView" destination="RCP-5r-oN0" id="NHl-Wk-bRa"/>
<outlet property="shareView" destination="qte-U6-Saw" id="tzG-cA-Q5Q"/>
<outlet property="totalLikes" destination="eEA-u2-Gv0" id="8LM-Nq-tao"/>
<outlet property="watchingDesc" destination="r9l-fV-2Nr" id="IXK-d7-w03"/>

View File

@@ -19,6 +19,7 @@ class GamesListVM{
func initView(){
setupCell()
vc.scrollView.indicatorStyle = .white // or .white
let color1 = #colorLiteral(red: 0.8, green: 0.6078431373, blue: 0.1098039216, alpha: 1)
let color2 = #colorLiteral(red: 0.8, green: 0.2901960784, blue: 0.1098039216, alpha: 1)
self.vc.view.applyGradient(colors: [color1,color2], startPoint: .Point.left.point , endPoint: .Point.right.point)

View File

@@ -27,6 +27,9 @@ class KaraokeDetailsVC: UIViewController {
@IBOutlet weak var likeView: UIView!
@IBOutlet weak var singNowBtn: LocalisedElementsButton!
@IBOutlet weak var outerView: UIView!
@IBOutlet weak var contentView: UIView!
var karaokeData : KaraokeListingDM.KaraokeDatum?
var delegate : ReloadAudioBooksFavLike?
@@ -40,8 +43,18 @@ class KaraokeDetailsVC: UIViewController {
singNowBtn.layer.shadowOpacity = 1.0
singNowBtn.layer.shadowRadius = 10.0
singNowBtn.layer.masksToBounds = false
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
outerView.addGestureRecognizer(tapGesture)
}
@objc func handleTap(_ gesture: UITapGestureRecognizer) {
let location = gesture.location(in: outerView)
if !contentView.frame.contains(location) {
self.dismiss(animated: true)
}
}
func initView(){
if let karaokeData{
if let url = karaokeData.thumbnailPath{
@@ -100,10 +113,6 @@ class KaraokeDetailsVC: UIViewController {
}
func tapHandler(){
self.view.addTapGesture {
self.dismiss(animated: true)
}
addView.addTapGesture { [weak self] in
if AuthFunc.shareInstance.guestUserLoginPopUp() { return}

View File

@@ -564,9 +564,11 @@
<outlet property="addIcon" destination="iIo-ei-G5K" id="DtQ-lC-hxs"/>
<outlet property="addLabel" destination="LUw-S0-LS7" id="duA-PF-SKa"/>
<outlet property="addView" destination="OCW-TW-vnc" id="Cfd-ml-ETG"/>
<outlet property="contentView" destination="olX-Tk-Nc1" id="L17-Ri-dYc"/>
<outlet property="likeIcon" destination="Xt6-nt-uzN" id="rq8-zW-60b"/>
<outlet property="likeLabel" destination="bc1-gA-wdL" id="7Fy-2p-kRj"/>
<outlet property="likeView" destination="7yn-Pm-yFj" id="UmV-JD-fkM"/>
<outlet property="outerView" destination="ikh-9O-ugN" id="AO9-dZ-p5C"/>
<outlet property="releaseDate" destination="imq-Oe-kqw" id="WgI-LF-gx2"/>
<outlet property="shareView" destination="D0l-lG-ZC6" id="P0S-7X-ToM"/>
<outlet property="singNowBtn" destination="ULn-gu-noT" id="ktZ-LI-ODe"/>

View File

@@ -20,6 +20,7 @@ class KaraokeListingVM{
func initView(){
setupCell()
vc.scrollView.indicatorStyle = .white // or .white
let color1 = #colorLiteral(red: 0.8, green: 0.6078431373, blue: 0.1098039216, alpha: 1)
let color2 = #colorLiteral(red: 0.8, green: 0.2901960784, blue: 0.1098039216, alpha: 1)
vc.title = "KARAOKE".localized(loc: AuthFunc.shareInstance.languageSelected.rawValue)

View File

@@ -853,9 +853,37 @@
<view key="view" contentMode="scaleToFill" id="Rgf-VB-8Sg">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dli-ld-4dd">
<rect key="frame" x="15" y="74" width="30" height="30"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="HPJ-GV-z0x"/>
<constraint firstAttribute="width" constant="30" id="YEl-Jq-Gne"/>
</constraints>
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="BackArrow"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="backBtnTapped:" destination="gNO-Lg-5q3" eventType="touchUpInside" id="i5o-ID-oM5"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="2gp-j2-aWC"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="dli-ld-4dd" firstAttribute="top" secondItem="2gp-j2-aWC" secondAttribute="top" constant="15" id="WZP-PS-eKd"/>
<constraint firstItem="dli-ld-4dd" firstAttribute="leading" secondItem="2gp-j2-aWC" secondAttribute="leading" constant="15" id="jRV-6s-U6h"/>
</constraints>
</view>
<connections>
<outlet property="backButton" destination="dli-ld-4dd" id="RBo-to-L7l"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="IIL-mJ-o64" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
@@ -1048,6 +1076,7 @@
</scenes>
<resources>
<image name="AudioBooks" width="172" height="120"/>
<image name="BackArrow" width="21.333333969116211" height="21.333333969116211"/>
<image name="BottomArrow" width="33" height="33"/>
<image name="BottomFrame" width="570.66668701171875" height="729.33331298828125"/>
<image name="Boy" width="49.666667938232422" height="50"/>
@@ -1079,10 +1108,10 @@
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.63529411759999999" green="0.51764705879999995" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGreenColor">
<color red="0.20392156862745098" green="0.7803921568627451" blue="0.34901960784313724" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>

View File

@@ -11,7 +11,7 @@ import AVKit
class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
@IBOutlet weak var innerPlayerView: UIView!
@IBOutlet weak var backButton: UIButton!
var previousScale: CGFloat = 1.0
var contentType : VideoContentType?
@@ -32,7 +32,7 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
UIView.setAnimationsEnabled(true)
}
func rotateToPotraitScapeDevice(){
func rotateToPortraitScapeDevice(){
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.myOrientation = .portrait
if #available(iOS 16.0, *) {
@@ -44,10 +44,27 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
// UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
UIView.setAnimationsEnabled(true)
}
// func rotateToPortraitScapeDevice() {
// let appDelegate = UIApplication.shared.delegate as! AppDelegate
// appDelegate.myOrientation = .portrait
//
// UIView.animate(withDuration: 0.3) {
// if #available(iOS 16.0, *) {
// let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
// windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: .portrait)) { error in
// print("Error updating geometry: \(error.localizedDescription)")
// }
// } else {
// UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
// }
// }
// }
override func viewDidLoad() {
super.viewDidLoad()
self.rotateToLandsScapeDevice()
self.view.bringSubviewToFront(backButton)
}
@objc func applicationDidBecomeActive() {
@@ -82,11 +99,21 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
player.stop()
}
@IBAction func backBtnTapped(_ sender: UIButton) {
self.transitionToFullScreen(animated: true)
}
// MARK: - JWPlayerViewControllerDelegate
override func jwplayer(_ player: any JWPlayer, didFinishLoadingWithTime loadTime: TimeInterval) {
super.jwplayer(player, didFinishLoadingWithTime: loadTime)
print("LoadTime", loadTime)
if let videoIndex{
player.nextUpPlaylistIndex = videoIndex
player.next()
self.videoIndex = nil
}
}
override func jwplayerIsReady(_ player: JWPlayer) {
@@ -98,9 +125,8 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
if videoIndex == 0{
player.seek(to: 0)
}else{
player.seek(to: 1)
player.nextUpPlaylistIndex = videoIndex ?? 0
player.next()
// player.nextUpPlaylistIndex = videoIndex ?? 0
// player.next()
}
case .trailer:
player.play()
@@ -121,8 +147,10 @@ class PlayerVC: JWPlayerViewController, JWPlayerViewControllerDelegate {
override func jwplayer(_ player: JWPlayer, failedWithError code: UInt, message: String) {
super.jwplayer(player, failedWithError: code, message: message)
// if no internet then add network observer
print("Error: \(code) - \(message)")
self.player.configurePlayer(with: config)
self.player.play()
}
override func jwplayer(_ player: JWPlayer, encounteredWarning code: UInt, message: String) {
@@ -160,14 +188,35 @@ extension PlayerVC {
func playerViewControllerWillGoFullScreen(_ controller: JWPlayerViewController) -> JWFullScreenViewController? {
// controller.shouldEnterFullScreen = false
// self.setDeviceOrientation(orientation: .portrait)
// self.setDeviceOrientation(orientation: .po0rtrait)
print("playerViewControllerWillGoFullScreen")
controller.player.stop()
self.rotateToPortraitScapeDevice()
return nil
}
func playerViewControllerDidGoFullScreen(_ controller: JWPlayerViewController) {
print("playerViewControllerDidGoFullScreen")
controller.dismissFullScreen(animated: true)
controller.player.stop()
// self.player.stop()
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
DispatchQueue.main.async { [weak self] in
guard let self else{return}
if contentType == .liveStream{
self.dismissTapped?()
}
self.dismiss(animated: true)
}
}
// self.player.stop()
// Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
// DispatchQueue.main.async {
// self.dismissTapped?()
// self.dismiss(animated: true)
// }
// }
return
}
@@ -180,7 +229,7 @@ extension PlayerVC {
// self.dismissTapped?()
// }
// }
self.rotateToPotraitScapeDevice()
// self.rotateToPotraitScapeDevice()
// self.dismiss
// self.setDeviceOrientation(orientation: .portrait)
// Timer.scheduledTimer(withTimeInterval: 1, repeats: false) { _ in
@@ -193,35 +242,13 @@ extension PlayerVC {
func playerViewControllerDidDismissFullScreen(_ controller: JWPlayerViewController) {
print("playerViewControllerDidDismissFullScreen")
self.dismissTapped?()
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
self.player.stop()
controller.dismiss(animated: true)
}
// self.dismissTapped?()
// Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
// self.player.stop()
// controller.dismiss(animated: true)
// }
// self.navigationController?.popViewController(animated: true)
}
// func playerViewControllerWillGoFullScreen(_ controller: JWPlayerViewController) -> JWFullScreenViewController? {
// print("playerViewControllerWillGoFullScreen")
// return nil
// }
//
// func playerViewControllerDidGoFullScreen(_ controller: JWPlayerViewController) {
// print("playerViewControllerDidGoFullScreen")
// }
//
// func playerViewControllerWillDismissFullScreen(_ controller: JWPlayerViewController) {
// print("playerViewControllerWillDismissFullScreen")
// self.player.stop()
// self.dismissTapped?()
// self.setDeviceOrientation(orientation: .portrait)
// }
//
// func playerViewControllerDidDismissFullScreen(_ controller: JWPlayerViewController) {
// print("playerViewControllerDidDismissFullScreen")
// Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false) { _ in
// self.navigationController?.popViewController(animated: true)
// }
// }
}
// MARK: - JWPlayerViewController Delegate Functions
@@ -229,7 +256,7 @@ extension PlayerVC {
extension PlayerVC {
func playerViewController(_ controller: JWPlayerKit.JWPlayerViewController, controlBarVisibilityChanged isVisible: Bool, frame: CGRect) {
// backButton.isHidden = !isVisible
self.backButton.isHidden = !isVisible
}
func playerViewController(_ controller: JWPlayerKit.JWPlayerViewController, sizeChangedFrom oldSize: CGSize, to newSize: CGSize) {

View File

@@ -51,7 +51,7 @@ class ThemeOneVC: UIViewController {
super.viewDidLoad()
vm.vc = self
vm.initView()
connectedToNetwork()
// connectedToNetwork()
}
override func viewWillDisappear(_ animated: Bool) {
@@ -87,10 +87,6 @@ class ThemeOneVC: UIViewController {
}
}
@IBAction func clickedBtn(_ sender: UIButton) {
print("Clicked")
}
@IBAction func barButtonTapped(_ sender: UIButton) {
self.sideMenuController?.revealMenu()
}

View File

@@ -19,7 +19,8 @@ class ThemeOneVM{
var playerLayer: AVPlayerLayer!
var shouldAnimate = true
// var jwPlayerViewController: JWPlayerViewController!
func initView(){
vc.bottomArrow.addTapGesture {
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
@@ -46,6 +47,59 @@ class ThemeOneVM{
}
func setupAvPlayer(){
// Ensure the liveStreamURL is valid
// guard let liveStreamURL = URL(string: self.liveStreamURL) else {
// print("Invalid live stream URL")
// Utilities.dismissProgressHUD()
// return
// }
// jwPlayerViewController = JWPlayerViewController()
// do{
// let videoSourceBuilder = try JWVideoSourceBuilder()
// // .defaultVideo(true)
// .file(liveStreamURL)
// .label("Live Stream")
// .build()
//
// // Create a JWPlayerItem
// let item = try JWPlayerItemBuilder()
// // .file(liveStreamURL)
// .videoSources([videoSourceBuilder])
// .build()
//
// // Create a JWPlayerConfiguration
// let config = try JWPlayerConfigurationBuilder()
// .playlist(items: [item])
//// .preload(JWPreload(rawValue: 20) ?? .none)
// .autostart(true)
// .build()
//
//
//
// // Add JWPlayerViewController's view as a subview
// self.vc.liveTvPlayer.addSubview(jwPlayerViewController.view)
// jwPlayerViewController.view.frame = self.vc.liveTvPlayer.bounds
//
//// // Set up constraints
//// jwPlayerViewController.view.translatesAutoresizingMaskIntoConstraints = false
//// NSLayoutConstraint.activate([
//// jwPlayerViewController.view.topAnchor.constraint(equalTo: self.vc.liveTvPlayer.topAnchor),
//// jwPlayerViewController.view.leadingAnchor.constraint(equalTo: self.vc.liveTvPlayer.leadingAnchor),
//// jwPlayerViewController.view.trailingAnchor.constraint(equalTo: self.vc.liveTvPlayer.trailingAnchor),
//// jwPlayerViewController.view.bottomAnchor.constraint(equalTo: self.vc.liveTvPlayer.bottomAnchor)
//// ])
// jwPlayerViewController.player.volume = 0.0
//
// jwPlayerViewController.player.configurePlayer(with: config)
// jwPlayerViewController.interfaceBehavior = .hidden
//// self.vc.liveTvPlayer.addSubview(jwPlayerViewController.view)
//// jwPlayerViewController.player.play()
//
// }catch{
// print(error)
// }
/*
Av Player Setup
*/
@@ -261,22 +315,22 @@ class ThemeOneVM{
// Create a JWPlayerConfiguration
let config = try JWPlayerConfigurationBuilder()
.playlist(items: [item])
// .preload(JWPreload(rawValue: 30) ?? .none)
.preload(JWPreload(rawValue: 20) ?? .none)
.autostart(true)
.build()
vc.config = config
vc.dismissTapped = self.tapped
vc.contentType = .liveStream
vc.modalPresentationStyle = .overFullScreen
vc.modalPresentationStyle = .fullScreen
DispatchQueue.main.async {
DispatchQueue.main.async { [weak self] in
guard let self else{return}
// Present the PlayerVC
self.vc.present(vc, animated: false) {
self.stopLiveStream()
vc.transitionToFullScreen(animated: true) {
print("FullScreen")
}
self.vc.present(vc, animated: false) { [weak self] in
guard let self else{return}
stopLiveStream()
}
}
} catch {

View File

@@ -12,6 +12,8 @@ class ContinueWatchingVC: UIViewController {
@IBOutlet weak var watchingImage: UIImageView!
@IBOutlet weak var watchingTitle: UILabel!
@IBOutlet weak var watchingDesc: UITextView!
@IBOutlet weak var outerView: UIView!
@IBOutlet weak var contentView: UIView!
var watchData : ContinueWatchingDM.ResultData?
@@ -23,6 +25,15 @@ class ContinueWatchingVC: UIViewController {
if watchData != nil{
setData()
}
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
outerView.addGestureRecognizer(tapGesture)
}
@objc func handleTap(_ gesture: UITapGestureRecognizer) {
let location = gesture.location(in: outerView)
if !contentView.frame.contains(location) {
self.dismiss(animated: true)
}
}
func setData(){

View File

@@ -54,7 +54,6 @@ class JWPlayerManager {
continue
}
let item = try JWPlayerItemBuilder()
.file(url)
.title(singleItem.titles ?? "")
@@ -111,6 +110,11 @@ class JWPlayerManager {
.playlist(items: items)
.autostart(true)
.build()
case .webSeries:
finalConfig = try JWPlayerConfigurationBuilder()
.playlist(items: items)
.autostart(true)
.build()
default:
// Create a JWPlayerConfiguration with the playlist
finalConfig = try JWPlayerConfigurationBuilder()
@@ -119,19 +123,18 @@ class JWPlayerManager {
.build()
}
playerVC.videoIndex = startIndex
playerVC.contentType = contentType
playerVC.config = finalConfig
playerVC.modalPresentationStyle = .overFullScreen
playerVC.modalPresentationStyle = .fullScreen
// Present the PlayerVC
Utilities.dismissProgressHUD()
viewController.present(playerVC, animated: false) {
completion?()
playerVC.transitionToFullScreen(animated: true) {
print("FullScreen")
}
// playerVC.transitionToFullScreen(animated: true) {
// print("FullScreen")
// }
}
} catch {
print("Error creating JWPlayer configuration: \(error)")
@@ -141,55 +144,4 @@ class JWPlayerManager {
// Dismiss the progress HUD after the view controller presentation
}
}
// func presentPlayer(from viewController: UIViewController, withURL liveStreamURL: String, title: String = "Testing Title", completion: (() -> Void)? = nil) {
// Utilities.startProgressHUD(msg: "Loading...")
//
// let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
// guard let playerVC = sb.instantiateViewController(identifier: "PlayerVC") as? PlayerVC else {
// print("PlayerVC not found")
// Utilities.dismissProgressHUD()
// return
// }
//
// DispatchQueue.main.async {
// do {
// // Ensure the liveStreamURL is valid
// guard let url = URL(string: liveStreamURL) else {
// print("Invalid live stream URL")
// Utilities.dismissProgressHUD()
// return
// }
//
// // Create a JWPlayerItem
// let item = try JWPlayerItemBuilder()
// .file(url)
// .title(title)
// .build()
//
// // Create a JWPlayerConfiguration
// let config = try JWPlayerConfigurationBuilder()
// .playlist(items: [item])
// .autostart(true)
// .build()
//
// playerVC.config = config
// playerVC.modalPresentationStyle = .overFullScreen
//
// // Present the PlayerVC
// viewController.present(playerVC, animated: false) {
// completion?()
// playerVC.transitionToFullScreen(animated: true) {
// print("FullScreen")
// }
// }
// } catch {
// print("Error creating JWPlayer configuration: \(error)")
// Utilities.dismissProgressHUD()
// }
//
// // Dismiss the progress HUD after the view controller presentation
// Utilities.dismissProgressHUD()
// }
// }
}

View File

@@ -1137,6 +1137,8 @@
</constraints>
</view>
<connections>
<outlet property="contentView" destination="cCC-Ly-sXY" id="p6k-fQ-Xhf"/>
<outlet property="outerView" destination="WoT-kA-uJY" id="z4k-ty-TK6"/>
<outlet property="watchingDesc" destination="MUz-A4-7TT" id="Lmh-1V-12C"/>
<outlet property="watchingImage" destination="lCX-qg-W0T" id="u95-td-2nl"/>
<outlet property="watchingTitle" destination="1Fo-Xt-kpO" id="j8W-DX-lYb"/>