播放进度上报
This commit is contained in:
parent
607bcafb32
commit
ff3f5a8f51
@ -84,6 +84,8 @@ class SPDeleteAccountViewController: SPViewController {
|
|||||||
button.setImage(UIImage(named: "check_icon_01_selected"), for: .selected)
|
button.setImage(UIImage(named: "check_icon_01_selected"), for: .selected)
|
||||||
button.setImage(UIImage(named: "check_icon_01_selected"), for: [.selected, .highlighted])
|
button.setImage(UIImage(named: "check_icon_01_selected"), for: [.selected, .highlighted])
|
||||||
button.addTarget(self, action: #selector(handleCheckButton), for: .touchUpInside)
|
button.addTarget(self, action: #selector(handleCheckButton), for: .touchUpInside)
|
||||||
|
button.setContentHuggingPriority(.required, for: .horizontal)
|
||||||
|
button.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -177,7 +179,7 @@ extension SPDeleteAccountViewController {
|
|||||||
make.top.equalToSuperview().offset(10)
|
make.top.equalToSuperview().offset(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
iconTextLabel.snp_makeConstraints { make in
|
iconTextLabel.snp.makeConstraints { make in
|
||||||
make.centerX.equalToSuperview()
|
make.centerX.equalToSuperview()
|
||||||
make.top.equalTo(iconImageView.snp.bottom).offset(12)
|
make.top.equalTo(iconImageView.snp.bottom).offset(12)
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ extension SPSettingsViewController {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if SPLoginManager.manager.isLogin {
|
if SPLoginManager.manager.isLogin {
|
||||||
}
|
|
||||||
arr.append(SPMineItem(type: .deleteAccount, title: "DeleteAccount".localized))
|
arr.append(SPMineItem(type: .deleteAccount, title: "DeleteAccount".localized))
|
||||||
arr.append(SPMineItem(type: .logout, title: "movia_signout".localized))
|
arr.append(SPMineItem(type: .logout, title: "movia_signout".localized))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return arr
|
return arr
|
||||||
|
@ -44,6 +44,7 @@ extension SPAboutUsCell {
|
|||||||
titleLabel.snp.makeConstraints { make in
|
titleLabel.snp.makeConstraints { make in
|
||||||
make.centerY.equalToSuperview()
|
make.centerY.equalToSuperview()
|
||||||
make.left.equalToSuperview().offset(16)
|
make.left.equalToSuperview().offset(16)
|
||||||
|
make.right.lessThanOrEqualToSuperview().offset(-80)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class SPMineHeaderView: UIView {
|
|||||||
if let name = userInfo?.family_name, name.count > 0 {
|
if let name = userInfo?.family_name, name.count > 0 {
|
||||||
nicknameLabel.text = name
|
nicknameLabel.text = name
|
||||||
} else {
|
} else {
|
||||||
nicknameLabel.text = "Vistor"
|
nicknameLabel.text = "movia_Visitor".localized
|
||||||
}
|
}
|
||||||
idLabel.text = "ID \(userInfo?.customer_id ?? "")"
|
idLabel.text = "ID \(userInfo?.customer_id ?? "")"
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
|
|||||||
override func viewWillDisappear(_ animated: Bool) {
|
override func viewWillDisappear(_ animated: Bool) {
|
||||||
super.viewWillDisappear(animated)
|
super.viewWillDisappear(animated)
|
||||||
|
|
||||||
self.uploadPlayTime()
|
// self.uploadPlayTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func play() {
|
override func play() {
|
||||||
@ -119,11 +119,15 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func currentPlayFinish() {
|
override func currentPlayFinish() {
|
||||||
if let videoInfo = self.viewModel.currentPlayer?.videoInfo, let activityId = self.activityId, let shortPlayId = videoInfo.short_play_id, let videoId = videoInfo.short_play_video_id {
|
if let videoInfo = self.viewModel.currentPlayer?.videoInfo, let shortPlayId = videoInfo.short_play_id, let videoId = videoInfo.short_play_video_id {
|
||||||
|
if let activityId = self.activityId {
|
||||||
//播放完成统计
|
//播放完成统计
|
||||||
SPVideoAPI.requestViewingFinish(shortPlayId: shortPlayId, videoId: videoId, activityId: activityId)
|
SPVideoAPI.requestViewingFinish(shortPlayId: shortPlayId, videoId: videoId, activityId: activityId)
|
||||||
|
}
|
||||||
|
|
||||||
//播放完成上报进度为0
|
//播放完成上报进度为0
|
||||||
SPVideoAPI.requestUploadPlayTime(shortPlayId: shortPlayId, videoId: videoId, seconds: 0)
|
SPVideoAPI.requestUploadPlayTime(shortPlayId: shortPlayId, videoId: videoId, seconds: 0)
|
||||||
|
self.viewModel.currentPlayer?.videoInfo?.play_seconds = 0
|
||||||
}
|
}
|
||||||
super.currentPlayFinish()
|
super.currentPlayFinish()
|
||||||
}
|
}
|
||||||
@ -133,14 +137,14 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
|
|||||||
|
|
||||||
|
|
||||||
//每播放5秒上报一次 播放时长小于上次上报时间也需要上报
|
//每播放5秒上报一次 播放时长小于上次上报时间也需要上报
|
||||||
// if (time >= lastUploadTime + 5 || time < lastUploadTime) && time >= 5 {
|
if (time >= lastUploadTime + 5 || time < lastUploadTime) && time >= 5 {
|
||||||
// lastUploadTime = time
|
lastUploadTime = time
|
||||||
//
|
uploadPlayTime()
|
||||||
// uploadPlayTime()
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func handleBack() {
|
override func handleBack() {
|
||||||
|
|
||||||
guard isShowRecommand else {
|
guard isShowRecommand else {
|
||||||
super.handleBack()
|
super.handleBack()
|
||||||
return
|
return
|
||||||
@ -282,6 +286,7 @@ extension SPPlayerDetailViewController {
|
|||||||
if currentTime >= duration {
|
if currentTime >= duration {
|
||||||
time = 0
|
time = 0
|
||||||
}
|
}
|
||||||
|
self.viewModel.currentPlayer?.videoInfo?.play_seconds = time * 1000
|
||||||
|
|
||||||
guard let shortPlayId = videoInfo?.short_play_id, let videoId = videoInfo?.short_play_video_id else { return }
|
guard let shortPlayId = videoInfo?.short_play_id, let videoId = videoInfo?.short_play_video_id else { return }
|
||||||
//上报播放时长
|
//上报播放时长
|
||||||
@ -388,7 +393,7 @@ extension SPPlayerDetailViewController {
|
|||||||
self.scrollToItem(indexPath: IndexPath(row: row, section: 0), animated: false) { [weak self] in
|
self.scrollToItem(indexPath: IndexPath(row: row, section: 0), animated: false) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
//跳转到指定进度
|
//跳转到指定进度
|
||||||
self.viewModel.currentPlayer?.seekToTime(toTime: (videoInfo.play_seconds ?? 0) / 1000)
|
// self.viewModel.currentPlayer?.seekToTime(toTime: (videoInfo.play_seconds ?? 0) / 1000)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.scrollToItem(indexPath: .init(row: 0, section: 0), animated: false)
|
self.scrollToItem(indexPath: .init(row: 0, section: 0), animated: false)
|
||||||
|
@ -21,6 +21,8 @@ import UIKit
|
|||||||
|
|
||||||
///当前展示的发生变化
|
///当前展示的发生变化
|
||||||
@objc optional func sp_playerListViewController(_ viewController: SPPlayerListViewController, didChangeIndexPathForVisible indexPath: IndexPath)
|
@objc optional func sp_playerListViewController(_ viewController: SPPlayerListViewController, didChangeIndexPathForVisible indexPath: IndexPath)
|
||||||
|
|
||||||
|
// @objc optional func sp_playerListViewController(_ viewController: SPPlayerListViewController, didScrollFromIndex fromIndex: Int, toIndex: Int)
|
||||||
///新页面展示完成
|
///新页面展示完成
|
||||||
// @objc optional func yd_playerViewController(playerListViewController: BCListPlayerViewController, didShowPlayerPage playerViewController: YDBasePlayerViewController)
|
// @objc optional func yd_playerViewController(playerListViewController: BCListPlayerViewController, didShowPlayerPage playerViewController: YDBasePlayerViewController)
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,10 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
|
|||||||
self.controlView.videoInfo = videoInfo
|
self.controlView.videoInfo = videoInfo
|
||||||
|
|
||||||
player.setPlayUrl(url: videoInfo?.video_url ?? "")
|
player.setPlayUrl(url: videoInfo?.video_url ?? "")
|
||||||
|
|
||||||
|
// self.seekToTime(toTime: (videoInfo?.play_seconds ?? 0) / 1000)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +102,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
|
|||||||
controlView.isCurrent = isCurrent
|
controlView.isCurrent = isCurrent
|
||||||
if !isCurrent {
|
if !isCurrent {
|
||||||
// self.player.replay()
|
// self.player.replay()
|
||||||
self.player.seekToTime(toTime: 0)
|
// self.player.seekToTime(toTime: 0)
|
||||||
self.coverImageView.isHidden = false
|
self.coverImageView.isHidden = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,4 +214,9 @@ extension SPPlayerListCell: SPPlayerDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func sp_playerReadyToPlay(_ player: SPPlayer) {
|
||||||
|
self.seekToTime(toTime: (videoInfo?.play_seconds ?? 0) / 1000)
|
||||||
|
// spLog(message: "play_seconds ====== \(videoInfo?.play_seconds ?? 0)")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,24 @@ class SPPayTemplateItem: SPModel, SmartCodable {
|
|||||||
case month = "month"
|
case month = "month"
|
||||||
case quarter = "quarter"
|
case quarter = "quarter"
|
||||||
case year = "year"
|
case year = "year"
|
||||||
|
|
||||||
|
func getText() -> String {
|
||||||
|
switch self {
|
||||||
|
case .week:
|
||||||
|
return "w_complex".localized
|
||||||
|
|
||||||
|
case .month:
|
||||||
|
return "m_complex".localized
|
||||||
|
|
||||||
|
case .quarter:
|
||||||
|
return "q_complex".localized
|
||||||
|
|
||||||
|
case .year:
|
||||||
|
return "Y_complex".localized
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class SPMemberRechargeCell: SPCollectionViewCell {
|
|||||||
var model: SPPayTemplateItem? {
|
var model: SPPayTemplateItem? {
|
||||||
didSet {
|
didSet {
|
||||||
desLabel.text = model?.sp_description
|
desLabel.text = model?.sp_description
|
||||||
typeLabel.text = model?.vip_type_key?.rawValue.capitalizingFirstLetter()
|
typeLabel.text = model?.vip_type_key?.getText()
|
||||||
currencyLabel.text = model?.currency
|
currencyLabel.text = model?.currency
|
||||||
moneyLabel.text = model?.price
|
moneyLabel.text = model?.price
|
||||||
if let sendCoins = model?.send_coins, sendCoins > 0 {
|
if let sendCoins = model?.send_coins, sendCoins > 0 {
|
||||||
|
@ -43,23 +43,23 @@ class SPAlertView: UIView {
|
|||||||
|
|
||||||
private lazy var cancelButton: UIButton = {
|
private lazy var cancelButton: UIButton = {
|
||||||
let button = UIButton(type: .custom)
|
let button = UIButton(type: .custom)
|
||||||
|
button.setBackgroundImage(UIImage(color: .colorFF1F1F()), for: .normal)
|
||||||
button.setTitleColor(.colorFFFFFF(), for: .normal)
|
button.setTitleColor(.colorFFFFFF(), for: .normal)
|
||||||
button.titleLabel?.font = .fontMedium(ofSize: 14)
|
button.titleLabel?.font = .fontMedium(ofSize: 14)
|
||||||
button.layer.cornerRadius = 18
|
button.layer.cornerRadius = 18
|
||||||
button.layer.masksToBounds = true
|
button.layer.masksToBounds = true
|
||||||
button.layer.borderWidth = 1
|
|
||||||
button.layer.borderColor = UIColor.colorFFFFFF().cgColor
|
|
||||||
button.addTarget(self, action: #selector(handleCancelButton), for: .touchUpInside)
|
button.addTarget(self, action: #selector(handleCancelButton), for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private lazy var sureButton: UIButton = {
|
private lazy var sureButton: UIButton = {
|
||||||
let button = UIButton(type: .custom)
|
let button = UIButton(type: .custom)
|
||||||
button.setBackgroundImage(UIImage(color: .colorFF1F1F()), for: .normal)
|
|
||||||
button.setTitleColor(.colorFFFFFF(), for: .normal)
|
button.setTitleColor(.colorFFFFFF(), for: .normal)
|
||||||
button.titleLabel?.font = .fontMedium(ofSize: 14)
|
button.titleLabel?.font = .fontMedium(ofSize: 14)
|
||||||
button.layer.cornerRadius = 18
|
button.layer.cornerRadius = 18
|
||||||
button.layer.masksToBounds = true
|
button.layer.masksToBounds = true
|
||||||
|
button.layer.borderWidth = 1
|
||||||
|
button.layer.borderColor = UIColor.colorFFFFFF().cgColor
|
||||||
button.addTarget(self, action: #selector(handleSureButton), for: .touchUpInside)
|
button.addTarget(self, action: #selector(handleSureButton), for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
@ -99,8 +99,8 @@ class SPAlertView: UIView {
|
|||||||
contentView.addSubview(cancelButton)
|
contentView.addSubview(cancelButton)
|
||||||
contentView.addSubview(sureButton)
|
contentView.addSubview(sureButton)
|
||||||
|
|
||||||
cancelButton.frame = CGRect(x: 30, y: alertHeight + 38, width: buttonWidth, height: buttonHeight)
|
sureButton.frame = CGRect(x: 30, y: alertHeight + 38, width: buttonWidth, height: buttonHeight)
|
||||||
sureButton.frame = CGRect(x: cancelButton.frame.maxX + 10.0, y: cancelButton.frame.minY, width: buttonWidth, height: buttonHeight)
|
cancelButton.frame = CGRect(x: sureButton.frame.maxX + 10.0, y: sureButton.frame.minY, width: buttonWidth, height: buttonHeight)
|
||||||
|
|
||||||
alertHeight = sureButton.frame.maxY + 34
|
alertHeight = sureButton.frame.maxY + 34
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ import ZFPlayer
|
|||||||
///显示首帧
|
///显示首帧
|
||||||
@objc optional func sp_firstRenderedStart(_ player: SPPlayer)
|
@objc optional func sp_firstRenderedStart(_ player: SPPlayer)
|
||||||
|
|
||||||
|
///准备完成
|
||||||
|
@objc optional func sp_playerReadyToPlay(_ player: SPPlayer)
|
||||||
|
|
||||||
///播放完成
|
///播放完成
|
||||||
@objc optional func sp_playCompletion(_ player: SPPlayer)
|
@objc optional func sp_playCompletion(_ player: SPPlayer)
|
||||||
|
|
||||||
@ -278,14 +281,15 @@ extension SPPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.playerReadyToPlay = { (asset, assetURL) in
|
player.playerReadyToPlay = { [weak self] (asset, assetURL) in
|
||||||
|
guard let self = self else { return }
|
||||||
do {
|
do {
|
||||||
try AVAudioSession.sharedInstance().setCategory(.playback)
|
try AVAudioSession.sharedInstance().setCategory(.playback)
|
||||||
try AVAudioSession.sharedInstance().setActive(true)
|
try AVAudioSession.sharedInstance().setActive(true)
|
||||||
} catch {
|
} catch {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
self.delegate?.sp_playerReadyToPlay?(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +107,11 @@
|
|||||||
"movia_logoutinfo" = "Are you sure you want to log out?";
|
"movia_logoutinfo" = "Are you sure you want to log out?";
|
||||||
"movia_delete" = "Delete";
|
"movia_delete" = "Delete";
|
||||||
"movia_deleteAccountInfo" = "Are you sure you want to deactivate your account?";
|
"movia_deleteAccountInfo" = "Are you sure you want to deactivate your account?";
|
||||||
|
"movia_Visitor" = "Visitor";
|
||||||
|
"w_complex" = "week";
|
||||||
|
"m_complex" = "months";
|
||||||
|
"q_complex" = "quarter";
|
||||||
|
"Y_complex" = "years";
|
||||||
|
|
||||||
"movia_iap_error_toast_01" = "Invalid in-app purchase";
|
"movia_iap_error_toast_01" = "Invalid in-app purchase";
|
||||||
///没有可恢复购买
|
///没有可恢复购买
|
||||||
|
Loading…
x
Reference in New Issue
Block a user