修复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 //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 }
// //

View File

@ -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()
} }
} }

View File

@ -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() {

View File

@ -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()
} }