修复bug
This commit is contained in:
parent
6e970b4a73
commit
4f402efabf
@ -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()
|
||||||
}
|
}
|
||||||
@ -290,7 +290,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 }
|
||||||
//上报播放时长
|
//上报播放时长
|
||||||
|
@ -231,11 +231,21 @@ 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,6 +397,7 @@ 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
|
|||||||
var playerFinishHadle: (() -> Void)?
|
var playerFinishHadle: (() -> Void)?
|
||||||
|
|
||||||
func prepare() {
|
func prepare() {
|
||||||
// player.prepare()
|
player.setPlayUrl(url: videoInfo?.video_url ?? "")
|
||||||
}
|
}
|
||||||
|
|
||||||
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