diff --git a/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift b/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift index 7534841..2547eed 100644 --- a/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift +++ b/MoviaBox/Class/Player/Controller/SPPlayerDetailViewController.swift @@ -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 } //上报播放时长 diff --git a/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift b/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift index cf44bb9..072e720 100644 --- a/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift +++ b/MoviaBox/Class/Player/Controller/SPPlayerListViewController.swift @@ -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() } } diff --git a/MoviaBox/Class/Player/View/SPPlayerListCell.swift b/MoviaBox/Class/Player/View/SPPlayerListCell.swift index 1d02fda..378816d 100644 --- a/MoviaBox/Class/Player/View/SPPlayerListCell.swift +++ b/MoviaBox/Class/Player/View/SPPlayerListCell.swift @@ -134,7 +134,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol { var playerFinishHadle: (() -> Void)? func prepare() { -// player.prepare() + player.setPlayUrl(url: videoInfo?.video_url ?? "") } func start() { diff --git a/MoviaBox/Libs/Player/SPPlayer.swift b/MoviaBox/Libs/Player/SPPlayer.swift index fb9e782..a4ec5ea 100644 --- a/MoviaBox/Libs/Player/SPPlayer.swift +++ b/MoviaBox/Libs/Player/SPPlayer.swift @@ -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() }