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