修复bug

This commit is contained in:
zeng 2025-06-16 10:15:58 +08:00
parent 6e970b4a73
commit 4f402efabf
4 changed files with 18 additions and 7 deletions

View File

@ -127,7 +127,7 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
//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()
}
@ -290,7 +290,7 @@ extension SPPlayerDetailViewController {
if currentTime >= duration {
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 }
//

View File

@ -231,11 +231,21 @@ class SPPlayerListViewController: SPViewController {
if self.autoNextEpisode {
scrollToNextEpisode()
}
self.viewModel.currentPlayer?.videoInfo?.play_seconds = 0
}
///
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() {
if getDataCount() > 0 && self.viewModel.isPlaying && isDidAppear {
self.viewModel.currentPlayer?.prepare()
self.viewModel.currentPlayer?.start()
}
}

View File

@ -134,7 +134,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
var playerFinishHadle: (() -> Void)?
func prepare() {
// player.prepare()
player.setPlayUrl(url: videoInfo?.video_url ?? "")
}
func start() {

View File

@ -148,9 +148,9 @@ class SPPlayer: NSObject {
func setPlayUrl(url: String) {
let proxyURL = KTVHTTPCache.proxyURL(withOriginalURL: URL(string: url))
if proxyURL != self.player.assetURL {
self.player.assetURL = proxyURL
}
// if proxyURL != self.player.assetURL {
// }
self.player.assetURL = proxyURL
// self.prepare()
}