Compare commits
No commits in common. "4f402efabf6e50dbf655ad338cd2834a65f6035e" and "fbc2d11d489966b01803ef6b0e873704e625daba" have entirely different histories.
4f402efabf
...
fbc2d11d48
@ -25,7 +25,6 @@ class SPVideoAPI: NSObject {
|
|||||||
var param = SPNetworkParameters(path: "/getVideoDetails")
|
var param = SPNetworkParameters(path: "/getVideoDetails")
|
||||||
param.method = .get
|
param.method = .get
|
||||||
param.parameters = parameters
|
param.parameters = parameters
|
||||||
param.isLoding = true
|
|
||||||
|
|
||||||
SPNetwork.request(parameters: param) { (response: SPNetworkResponse<SPVideoDetailModel>) in
|
SPNetwork.request(parameters: param) { (response: SPNetworkResponse<SPVideoDetailModel>) in
|
||||||
completer?(response.data)
|
completer?(response.data)
|
||||||
|
@ -127,7 +127,7 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
|
|||||||
|
|
||||||
//播放完成上报进度为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
|
self.viewModel.currentPlayer?.videoInfo?.play_seconds = 0
|
||||||
}
|
}
|
||||||
super.currentPlayFinish()
|
super.currentPlayFinish()
|
||||||
}
|
}
|
||||||
@ -235,10 +235,6 @@ extension SPPlayerDetailViewController {
|
|||||||
let view = SPPlayBuyView()
|
let view = SPPlayBuyView()
|
||||||
view.shortPlayId = videoInfo.short_play_id
|
view.shortPlayId = videoInfo.short_play_id
|
||||||
view.videoId = videoInfo.short_play_video_id
|
view.videoId = videoInfo.short_play_video_id
|
||||||
view.buyFinishBlock = { [weak self] in
|
|
||||||
guard let self = self else { return }
|
|
||||||
self.requestDetailData(indexPath: self.currentIndexPath)
|
|
||||||
}
|
|
||||||
view.present(in: nil)
|
view.present(in: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +286,7 @@ extension SPPlayerDetailViewController {
|
|||||||
if currentTime >= duration {
|
if currentTime >= duration {
|
||||||
time = 0
|
time = 0
|
||||||
}
|
}
|
||||||
// self.viewModel.currentPlayer?.videoInfo?.play_seconds = time * 1000
|
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 }
|
||||||
//上报播放时长
|
//上报播放时长
|
||||||
@ -299,15 +295,15 @@ extension SPPlayerDetailViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc private func buyVipFinishNotification() {
|
@objc private func buyVipFinishNotification() {
|
||||||
// guard SPLoginManager.manager.userInfo?.is_vip == true else { return }
|
guard SPLoginManager.manager.userInfo?.is_vip == true else { return }
|
||||||
//
|
|
||||||
// self.detailModel?.episodeList?.forEach({
|
self.detailModel?.episodeList?.forEach({
|
||||||
// $0.is_lock = false
|
$0.is_lock = false
|
||||||
// })
|
})
|
||||||
//
|
|
||||||
// self.reloadData { [weak self] in
|
self.reloadData { [weak self] in
|
||||||
// self?.play()
|
self?.play()
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
///网络切换通知
|
///网络切换通知
|
||||||
@objc private func reachabilityDidChangeNotification() {
|
@objc private func reachabilityDidChangeNotification() {
|
||||||
@ -372,7 +368,7 @@ extension SPPlayerDetailViewController {
|
|||||||
|
|
||||||
extension SPPlayerDetailViewController {
|
extension SPPlayerDetailViewController {
|
||||||
|
|
||||||
private func requestDetailData(indexPath: IndexPath? = nil) {
|
private func requestDetailData() {
|
||||||
guard let shortPlayId = self.shortPlayId else { return }
|
guard let shortPlayId = self.shortPlayId else { return }
|
||||||
isShowRecommand = false
|
isShowRecommand = false
|
||||||
recommandTimer?.invalidate()
|
recommandTimer?.invalidate()
|
||||||
@ -386,10 +382,7 @@ extension SPPlayerDetailViewController {
|
|||||||
self.reloadData { [weak self] in
|
self.reloadData { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
if let indexPath = indexPath, indexPath.row < (model.episodeList?.count ?? 0) {
|
if let videoInfo = self.detailModel?.video_info {
|
||||||
self.scrollToItem(indexPath: indexPath, animated: false)
|
|
||||||
|
|
||||||
} else if let videoInfo = self.detailModel?.video_info {
|
|
||||||
var row: Int?
|
var row: Int?
|
||||||
self.detailModel?.episodeList?.enumerated().forEach({
|
self.detailModel?.episodeList?.enumerated().forEach({
|
||||||
if $1.id == videoInfo.id {
|
if $1.id == videoInfo.id {
|
||||||
@ -397,7 +390,11 @@ extension SPPlayerDetailViewController {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if let row = row {
|
if let row = row {
|
||||||
self.scrollToItem(indexPath: .init(row: row, section: 0), animated: false)
|
self.scrollToItem(indexPath: IndexPath(row: row, section: 0), animated: false) { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
//跳转到指定进度
|
||||||
|
// 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)
|
||||||
}
|
}
|
||||||
|
@ -231,21 +231,11 @@ class SPPlayerListViewController: SPViewController {
|
|||||||
if self.autoNextEpisode {
|
if self.autoNextEpisode {
|
||||||
scrollToNextEpisode()
|
scrollToNextEpisode()
|
||||||
}
|
}
|
||||||
self.viewModel.currentPlayer?.videoInfo?.play_seconds = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///当前播放进度变更 子类可重写
|
///当前播放进度变更 子类可重写
|
||||||
func currentPlayTimeDidChange(time: Int) {
|
func currentPlayTimeDidChange(time: Int) {
|
||||||
let currentTime = self.viewModel.currentPlayer?.currentPosition ?? 0
|
|
||||||
// let duration = self.viewModel.currentPlayer?.duration ?? 0
|
|
||||||
//
|
|
||||||
// var time = currentTime
|
|
||||||
// if currentTime >= duration {
|
|
||||||
// time = 0
|
|
||||||
// }
|
|
||||||
if time > 1 {
|
|
||||||
self.viewModel.currentPlayer?.videoInfo?.play_seconds = time * 1000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +387,6 @@ extension SPPlayerListViewController {
|
|||||||
|
|
||||||
@objc func didBecomeActiveNotification() {
|
@objc func didBecomeActiveNotification() {
|
||||||
if getDataCount() > 0 && self.viewModel.isPlaying && isDidAppear {
|
if getDataCount() > 0 && self.viewModel.isPlaying && isDidAppear {
|
||||||
self.viewModel.currentPlayer?.prepare()
|
|
||||||
self.viewModel.currentPlayer?.start()
|
self.viewModel.currentPlayer?.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ import UIKit
|
|||||||
|
|
||||||
class SPPlayBuyView: HWPanModalContentView {
|
class SPPlayBuyView: HWPanModalContentView {
|
||||||
|
|
||||||
var buyFinishBlock: (() -> Void)?
|
|
||||||
|
|
||||||
var shortPlayId: String? {
|
var shortPlayId: String? {
|
||||||
didSet {
|
didSet {
|
||||||
rechargeView.shortPlayId = shortPlayId
|
rechargeView.shortPlayId = shortPlayId
|
||||||
@ -124,7 +122,6 @@ extension SPPlayBuyView {
|
|||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
self.rechargeView.userInfo = SPLoginManager.manager.userInfo
|
self.rechargeView.userInfo = SPLoginManager.manager.userInfo
|
||||||
}
|
}
|
||||||
self.buyFinishBlock?()
|
|
||||||
|
|
||||||
self.dismiss(animated: true) {
|
self.dismiss(animated: true) {
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
|
|||||||
var playerFinishHadle: (() -> Void)?
|
var playerFinishHadle: (() -> Void)?
|
||||||
|
|
||||||
func prepare() {
|
func prepare() {
|
||||||
player.setPlayUrl(url: videoInfo?.video_url ?? "")
|
// player.prepare()
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start() {
|
||||||
|
@ -148,9 +148,9 @@ class SPPlayer: NSObject {
|
|||||||
|
|
||||||
func setPlayUrl(url: String) {
|
func setPlayUrl(url: String) {
|
||||||
let proxyURL = KTVHTTPCache.proxyURL(withOriginalURL: URL(string: url))
|
let proxyURL = KTVHTTPCache.proxyURL(withOriginalURL: URL(string: url))
|
||||||
// if proxyURL != self.player.assetURL {
|
if proxyURL != self.player.assetURL {
|
||||||
// }
|
self.player.assetURL = proxyURL
|
||||||
self.player.assetURL = proxyURL
|
}
|
||||||
// self.prepare()
|
// self.prepare()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user