播放bug修复
This commit is contained in:
parent
337c25baaf
commit
46d142cf37
@ -14,6 +14,7 @@ extension AppDelegate {
|
|||||||
//facebook
|
//facebook
|
||||||
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
|
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
|
|
||||||
|
///设置刷新控件的语言
|
||||||
|
MJRefreshConfig.default.languageCode = VPLocalizedManager.shared.mjLocalizedKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,14 @@ class VPExploreViewController: VPVideoPlayerViewController {
|
|||||||
|
|
||||||
var pagination: VPListPaginationModel?
|
var pagination: VPListPaginationModel?
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
NotificationCenter.default.removeObserver(self)
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(loginStateDidChangeNotification), name: VPLoginManager.loginStateDidChangeNotification, object: nil)
|
||||||
|
|
||||||
self.delegate = self
|
self.delegate = self
|
||||||
self.dataSource = self
|
self.dataSource = self
|
||||||
|
|
||||||
@ -30,6 +35,9 @@ class VPExploreViewController: VPVideoPlayerViewController {
|
|||||||
self.navigationController?.setNavigationBarHidden(true, animated: true)
|
self.navigationController?.setNavigationBarHidden(true, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc private func loginStateDidChangeNotification() {
|
||||||
|
requestDataArr(page: 1)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +47,7 @@ extension VPExploreViewController: VPPlayerListViewControllerDelegate {
|
|||||||
guard let pagination = self.pagination else { return }
|
guard let pagination = self.pagination else { return }
|
||||||
guard let page = self.pagination?.current_page else { return }
|
guard let page = self.pagination?.current_page else { return }
|
||||||
let pageSize = pagination.page_size ?? 0
|
let pageSize = pagination.page_size ?? 0
|
||||||
if pagination.page_total ?? 0 <= pageSize * page {
|
if pagination.total_size ?? 0 <= pageSize * page {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.requestDataArr(page: page + 1)
|
self.requestDataArr(page: page + 1)
|
||||||
|
@ -125,6 +125,7 @@ class VPCollectListViewController: VPViewController {
|
|||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(updateShortCollectStateNotification), name: VPVideoAPI.updateShortCollectStateNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(updateShortCollectStateNotification), name: VPVideoAPI.updateShortCollectStateNotification, object: nil)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(loginStateDidChangeNotification), name: VPLoginManager.loginStateDidChangeNotification, object: nil)
|
||||||
|
|
||||||
self.bgImageView.isHidden = true
|
self.bgImageView.isHidden = true
|
||||||
self.view.backgroundColor = .clear
|
self.view.backgroundColor = .clear
|
||||||
@ -241,6 +242,11 @@ extension VPCollectListViewController {
|
|||||||
updateNode += 1
|
updateNode += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc private func loginStateDidChangeNotification() {
|
||||||
|
requestDataArr(page: 1, completer: nil)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension VPCollectListViewController {
|
extension VPCollectListViewController {
|
||||||
|
@ -31,8 +31,13 @@ class VPWatchHistoryViewController: VPViewController {
|
|||||||
return tableView
|
return tableView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
NotificationCenter.default.removeObserver(self)
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(loginStateDidChangeNotification), name: VPLoginManager.loginStateDidChangeNotification, object: nil)
|
||||||
|
|
||||||
self.bgImageView.isHidden = true
|
self.bgImageView.isHidden = true
|
||||||
self.view.backgroundColor = .clear
|
self.view.backgroundColor = .clear
|
||||||
@ -57,6 +62,12 @@ class VPWatchHistoryViewController: VPViewController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension VPWatchHistoryViewController {
|
||||||
|
@objc private func loginStateDidChangeNotification() {
|
||||||
|
requestDataArr(page: 1, completer: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension VPWatchHistoryViewController {
|
extension VPWatchHistoryViewController {
|
||||||
|
|
||||||
private func vp_setupUI() {
|
private func vp_setupUI() {
|
||||||
|
@ -68,8 +68,10 @@ class VPDetailPlayerViewController: VPVideoPlayerViewController {
|
|||||||
if videoInfo.is_lock == true {
|
if videoInfo.is_lock == true {
|
||||||
self.pause()
|
self.pause()
|
||||||
|
|
||||||
|
let myCoin = VPLoginManager.manager.userInfo?.totalCoin ?? 0
|
||||||
|
if myCoin < (videoInfo.coins ?? 0), self.viewModel.currentPlayer?.hasLastEpisodeUnlocked != true {
|
||||||
self.onRecharge()
|
self.onRecharge()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +196,13 @@ extension VPDetailPlayerViewController: VPPlayerListViewControllerDataSource {
|
|||||||
cell.videoInfo = detailModel?.episodeList?[indexPath.row]
|
cell.videoInfo = detailModel?.episodeList?[indexPath.row]
|
||||||
cell.isLoop = false
|
cell.isLoop = false
|
||||||
|
|
||||||
|
let upRow = indexPath.row - 1
|
||||||
|
if upRow >= 0, let videoInfo = detailModel?.episodeList?[upRow], videoInfo.is_lock == true {
|
||||||
|
cell.hasLastEpisodeUnlocked = true
|
||||||
|
} else {
|
||||||
|
cell.hasLastEpisodeUnlocked = false
|
||||||
|
}
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,16 @@ class VPVideoPlayerViewController: VPViewController {
|
|||||||
self.viewModel.currentPlayer?.pause()
|
self.viewModel.currentPlayer?.pause()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clearDataArr() {
|
||||||
|
self.dataArr.removeAll()
|
||||||
|
self.viewModel.currentPlayer = nil
|
||||||
|
self.currentIndexPath = .init(row: 0, section: 0)
|
||||||
|
self.collectionView.contentOffset = .init(x: 0, y: 0)
|
||||||
|
self.collectionView.reloadData()
|
||||||
|
}
|
||||||
|
|
||||||
func setDataArr(dataArr: [Any], completer: (() -> Void)?) {
|
func setDataArr(dataArr: [Any], completer: (() -> Void)?) {
|
||||||
|
self.clearDataArr()
|
||||||
self.dataArr = dataArr
|
self.dataArr = dataArr
|
||||||
reloadData(completion: completer)
|
reloadData(completion: completer)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import UIKit
|
|||||||
var isCurrent: Bool { get set }
|
var isCurrent: Bool { get set }
|
||||||
|
|
||||||
///上一集是否加锁
|
///上一集是否加锁
|
||||||
@objc optional var hasLockUpEpisode: Bool { get set }
|
@objc optional var hasLastEpisodeUnlocked: Bool { get set }
|
||||||
|
|
||||||
///总进度
|
///总进度
|
||||||
var duration: Int { get }
|
var duration: Int { get }
|
||||||
|
@ -13,4 +13,10 @@ class VPDetailPlayerCell: VPVideoPlayerCell {
|
|||||||
return VPDetailPlayerControlView.self
|
return VPDetailPlayerControlView.self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override var hasLastEpisodeUnlocked: Bool {
|
||||||
|
didSet {
|
||||||
|
guard let controlView = self.controlView as? VPDetailPlayerControlView else { return }
|
||||||
|
controlView.hasLastEpisodeUnlocked = hasLastEpisodeUnlocked
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,12 @@ class VPDetailPlayerControlView: VPVideoPlayerControlView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasLastEpisodeUnlocked = false {
|
||||||
|
didSet {
|
||||||
|
self.lockView.hasLastEpisodeUnlocked = hasLastEpisodeUnlocked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override var videoInfo: VPVideoInfoModel? {
|
override var videoInfo: VPVideoInfoModel? {
|
||||||
didSet {
|
didSet {
|
||||||
|
@ -15,6 +15,12 @@ class VPVideoLockView: UIView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasLastEpisodeUnlocked = false {
|
||||||
|
didSet {
|
||||||
|
unlockButton.setNeedsUpdateConfiguration()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var clickUnlockButton: (() -> Void)?
|
var clickUnlockButton: (() -> Void)?
|
||||||
|
|
||||||
private lazy var unlockButton: UIButton = {
|
private lazy var unlockButton: UIButton = {
|
||||||
@ -33,7 +39,12 @@ class VPVideoLockView: UIView {
|
|||||||
button.layer.masksToBounds = true
|
button.layer.masksToBounds = true
|
||||||
button.configurationUpdateHandler = { [weak self] button in
|
button.configurationUpdateHandler = { [weak self] button in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
let title = String(format: "Unlocking costs %@ coins".localized, "\(videoInfo?.coins ?? 0)")
|
let title: String
|
||||||
|
if hasLastEpisodeUnlocked {
|
||||||
|
title = "kVideoLockTipText".localized
|
||||||
|
} else {
|
||||||
|
title = String(format: "Unlocking costs %@ coins".localized, "\(videoInfo?.coins ?? 0)")
|
||||||
|
}
|
||||||
let string = AttributedString.createAttributedString(string: title, color: .colorFFFFFF(), font: .fontRegular(ofSize: 14))
|
let string = AttributedString.createAttributedString(string: title, color: .colorFFFFFF(), font: .fontRegular(ofSize: 14))
|
||||||
button.configuration?.attributedTitle = string
|
button.configuration?.attributedTitle = string
|
||||||
}
|
}
|
||||||
@ -68,8 +79,12 @@ class VPVideoLockView: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc private func handleUnlockButton() {
|
@objc private func handleUnlockButton() {
|
||||||
|
if hasLastEpisodeUnlocked {
|
||||||
|
VPToast.show(text: "kUnlockVideoErrorToast01".localized)
|
||||||
|
} else {
|
||||||
self.clickUnlockButton?()
|
self.clickUnlockButton?()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc private func userInfoUpdateNotification() {
|
@objc private func userInfoUpdateNotification() {
|
||||||
let userInfo = VPLoginManager.manager.userInfo
|
let userInfo = VPLoginManager.manager.userInfo
|
||||||
|
@ -65,7 +65,7 @@ class VPVideoPlayerCell: VPCollectionViewCell, VPPlayerProtocol {
|
|||||||
return imageView
|
return imageView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private lazy var controlView: VPVideoPlayerControlView = {
|
private(set) lazy var controlView: VPVideoPlayerControlView = {
|
||||||
let view = ControlViewClass.init()
|
let view = ControlViewClass.init()
|
||||||
view.panProgressFinishBlock = { [weak self] progress in
|
view.panProgressFinishBlock = { [weak self] progress in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
@ -102,6 +102,8 @@ class VPVideoPlayerCell: VPCollectionViewCell, VPPlayerProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasLastEpisodeUnlocked: Bool = false
|
||||||
|
|
||||||
var duration: Int {
|
var duration: Int {
|
||||||
get {
|
get {
|
||||||
return player.duration
|
return player.duration
|
||||||
|
@ -169,9 +169,9 @@ class VPPlayer: NSObject {
|
|||||||
|
|
||||||
func start() {
|
func start() {
|
||||||
self.isPlaying = true
|
self.isPlaying = true
|
||||||
if self.interruptionType != .began {
|
// if self.interruptionType != .began {
|
||||||
|
// }
|
||||||
player.play()
|
player.play()
|
||||||
}
|
|
||||||
|
|
||||||
UIApplication.shared.isIdleTimerDisabled = true
|
UIApplication.shared.isIdleTimerDisabled = true
|
||||||
self.addIdleTimerDisabledObserver()
|
self.addIdleTimerDisabledObserver()
|
||||||
@ -317,6 +317,7 @@ extension VPPlayer {
|
|||||||
self.player.play()
|
self.player.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// vpLog(message: "======音频发生变化\(interruptionType)")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,5 +50,11 @@
|
|||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>UIBackgroundModes</key>
|
||||||
|
<array>
|
||||||
|
<string>fetch</string>
|
||||||
|
<string>remote-notification</string>
|
||||||
|
<string>audio</string>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
"kVipPrivilegeText5" = "The donate coins will expire in %@";
|
"kVipPrivilegeText5" = "The donate coins will expire in %@";
|
||||||
"kVipPrivilegeText6" = "Auto renew, cancel anytime";
|
"kVipPrivilegeText6" = "Auto renew, cancel anytime";
|
||||||
"kLoginAgreementText" = "By logging in you agree to: %@ & %@";
|
"kLoginAgreementText" = "By logging in you agree to: %@ & %@";
|
||||||
|
"kVideoLockTipText" = "Please unlock the previous episode";
|
||||||
//无网提示
|
//无网提示
|
||||||
"kNetworkToast01" = "The service is abnormal. Check the network.";
|
"kNetworkToast01" = "The service is abnormal. Check the network.";
|
||||||
//解锁上一集提示
|
//解锁上一集提示
|
||||||
@ -112,6 +113,8 @@
|
|||||||
"kIapErrorToast02" = "Invalid in-app purchase";
|
"kIapErrorToast02" = "Invalid in-app purchase";
|
||||||
///没有可恢复购买
|
///没有可恢复购买
|
||||||
"kIapErrorToast03" = "There are no in-app purchases to restore.";
|
"kIapErrorToast03" = "There are no in-app purchases to restore.";
|
||||||
|
///请购买上一集
|
||||||
|
"kUnlockVideoErrorToast01" = "The prequel to this series is not unlocked. Please unlock the prequel before unlocking this series";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,3 +11,7 @@ D-U-N-S :616751820
|
|||||||
认证官网 :https://www.qjwl168.com
|
认证官网 :https://www.qjwl168.com
|
||||||
账号 :hn.qinjiu.developer@icloud.com
|
账号 :hn.qinjiu.developer@icloud.com
|
||||||
密码 :Discover2024
|
密码 :Discover2024
|
||||||
|
|
||||||
|
沙盒账号
|
||||||
|
veloria@test.com
|
||||||
|
Test@168
|
Loading…
x
Reference in New Issue
Block a user