播放器优化,历史记录进入指定集数
This commit is contained in:
parent
b52e1b4a21
commit
367f18a20e
@ -438,11 +438,11 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = 36QJHAN62Q;
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = ShortPlay/Source/Info.plist;
|
INFOPLIST_FILE = ShortPlay/Source/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = ZyreoTV;
|
INFOPLIST_KEY_CFBundleDisplayName = Thimra;
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||||
INFOPLIST_KEY_UIMainStoryboardFile = "";
|
INFOPLIST_KEY_UIMainStoryboardFile = "";
|
||||||
@ -475,11 +475,11 @@
|
|||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = 36QJHAN62Q;
|
DEVELOPMENT_TEAM = "";
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = ShortPlay/Source/Info.plist;
|
INFOPLIST_FILE = ShortPlay/Source/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = ZyreoTV;
|
INFOPLIST_KEY_CFBundleDisplayName = Thimra;
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||||
INFOPLIST_KEY_UIMainStoryboardFile = "";
|
INFOPLIST_KEY_UIMainStoryboardFile = "";
|
||||||
|
@ -73,7 +73,7 @@ extension SPExploreViewController {
|
|||||||
self.setDataArr(dataArr: list)
|
self.setDataArr(dataArr: list)
|
||||||
self.play()
|
self.play()
|
||||||
} else {
|
} else {
|
||||||
|
self.addDataArr(dataArr: list)
|
||||||
}
|
}
|
||||||
self.pagination = listModel.pagination
|
self.pagination = listModel.pagination
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ extension SPPlayHistoryViewController: UICollectionViewDelegate, UICollectionVie
|
|||||||
} else {
|
} else {
|
||||||
let vc = SPPlayerDetailViewController()
|
let vc = SPPlayerDetailViewController()
|
||||||
vc.shortPlayId = model.short_play_id
|
vc.shortPlayId = model.short_play_id
|
||||||
|
vc.playHistoryModel = model
|
||||||
self.navigationController?.pushViewController(vc, animated: true)
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ class SPPlayerDetailViewController: SPPlayerListViewController {
|
|||||||
|
|
||||||
var videoId: String?
|
var videoId: String?
|
||||||
var shortPlayId: String?
|
var shortPlayId: String?
|
||||||
|
var playHistoryModel: SPShortModel?
|
||||||
|
|
||||||
private var detailModel: SPVideoDetailModel?
|
private var detailModel: SPVideoDetailModel?
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ extension SPPlayerDetailViewController {
|
|||||||
view.shortModel = detailModel?.shortPlayInfo
|
view.shortModel = detailModel?.shortPlayInfo
|
||||||
view.currentIndex = self.currentIndexPath.row
|
view.currentIndex = self.currentIndexPath.row
|
||||||
view.didSelectedIndex = { [weak self] (index) in
|
view.didSelectedIndex = { [weak self] (index) in
|
||||||
self?.scrollToItem(indexPath: IndexPath(row: index, section: 0))
|
self?.scrollToItem(indexPath: IndexPath(row: index, section: 0), animated: false)
|
||||||
}
|
}
|
||||||
view.present(in: nil)
|
view.present(in: nil)
|
||||||
self.episodeView = view
|
self.episodeView = view
|
||||||
@ -135,7 +136,7 @@ extension SPPlayerDetailViewController: SPPlayerListViewControllerDataSource, SP
|
|||||||
self.episodeView?.currentIndex = indexPath.row
|
self.episodeView?.currentIndex = indexPath.row
|
||||||
let videoInfo = detailModel?.episodeList?[indexPath.row]
|
let videoInfo = detailModel?.episodeList?[indexPath.row]
|
||||||
|
|
||||||
titleLabel.text = String(format: "kPlayerDetailTitleString".localized, "\(videoInfo?.episode ?? 0)", self.detailModel?.shortPlayInfo?.name ?? "")
|
titleLabel.text = String(format: "kPlayerDetailTitleString".localized, "\(videoInfo?.episode ?? "0")", self.detailModel?.shortPlayInfo?.name ?? "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,8 +150,25 @@ extension SPPlayerDetailViewController {
|
|||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
if let model = model {
|
if let model = model {
|
||||||
self.detailModel = model
|
self.detailModel = model
|
||||||
self.reloadData()
|
self.reloadData { [weak self] in
|
||||||
self.play()
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
if let playHistoryModel = self.playHistoryModel {
|
||||||
|
var row: Int?
|
||||||
|
self.detailModel?.episodeList?.enumerated().forEach({
|
||||||
|
if $1.episode == playHistoryModel.current_episode {
|
||||||
|
row = $0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if let row = row {
|
||||||
|
self.scrollToItem(indexPath: IndexPath(row: row, section: 0), animated: false)
|
||||||
|
}
|
||||||
|
self.playHistoryModel = nil
|
||||||
|
} else {
|
||||||
|
self.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,27 @@ class SPPlayerListViewController: SPViewController {
|
|||||||
|
|
||||||
func setDataArr(dataArr: [Any]) {
|
func setDataArr(dataArr: [Any]) {
|
||||||
self.dataArr = dataArr
|
self.dataArr = dataArr
|
||||||
|
|
||||||
reloadData()
|
reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addDataArr(dataArr: [Any]) {
|
||||||
|
guard dataArr.count > 0 else { return }
|
||||||
|
|
||||||
|
var indexPaths: [IndexPath] = []
|
||||||
|
var startRow = self.dataArr.count
|
||||||
|
|
||||||
|
dataArr.forEach { _ in
|
||||||
|
indexPaths.append(IndexPath(row: startRow, section: 0))
|
||||||
|
startRow += 1
|
||||||
|
}
|
||||||
|
self.dataArr += dataArr
|
||||||
|
|
||||||
|
CATransaction.setCompletionBlock(nil)
|
||||||
|
CATransaction.begin()
|
||||||
|
self.collectionView.insertItems(at: indexPaths)
|
||||||
|
CATransaction.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func clearDataArr() {
|
func clearDataArr() {
|
||||||
self.dataArr.removeAll()
|
self.dataArr.removeAll()
|
||||||
@ -147,7 +164,10 @@ class SPPlayerListViewController: SPViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func reloadData() {
|
func reloadData(completion: (() -> Void)? = nil) {
|
||||||
|
CATransaction.setCompletionBlock {
|
||||||
|
completion?()
|
||||||
|
}
|
||||||
CATransaction.begin()
|
CATransaction.begin()
|
||||||
self.collectionView.reloadData()
|
self.collectionView.reloadData()
|
||||||
CATransaction.commit()
|
CATransaction.commit()
|
||||||
@ -157,8 +177,18 @@ class SPPlayerListViewController: SPViewController {
|
|||||||
return self.collectionView(self.collectionView, numberOfItemsInSection: 0)
|
return self.collectionView(self.collectionView, numberOfItemsInSection: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func scrollToItem(indexPath: IndexPath) {
|
func scrollToItem(indexPath: IndexPath, animated: Bool = true) {
|
||||||
self.collectionView.scrollToItem(at: indexPath, at: .top, animated: true);
|
CATransaction.setCompletionBlock { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
if !animated {
|
||||||
|
if self.currentIndexPath != indexPath {
|
||||||
|
self.skip(indexPath: indexPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATransaction.begin()
|
||||||
|
self.collectionView.scrollToItem(at: indexPath, at: .top, animated: animated);
|
||||||
|
CATransaction.commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +294,8 @@ extension SPPlayerListViewController: UICollectionViewDelegate, UICollectionView
|
|||||||
didChangeIndexPathForVisible()
|
didChangeIndexPathForVisible()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spLog(message: "++++++++\(indexPath)")
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ class SPShortModel: SPModel, SmartCodable {
|
|||||||
var tag_type: String?
|
var tag_type: String?
|
||||||
var video_info: SPVideoInfoModel?
|
var video_info: SPVideoInfoModel?
|
||||||
var watch_total: Int?
|
var watch_total: Int?
|
||||||
|
var current_episode: String?
|
||||||
|
|
||||||
@IgnoredKey
|
@IgnoredKey
|
||||||
var titleAttributedString: NSAttributedString?
|
var titleAttributedString: NSAttributedString?
|
||||||
|
@ -12,7 +12,7 @@ class SPVideoInfoModel: SPModel, SmartCodable {
|
|||||||
|
|
||||||
var coins: Int?
|
var coins: Int?
|
||||||
var vip_coins: Int?
|
var vip_coins: Int?
|
||||||
var episode: Int?
|
var episode: String?
|
||||||
var id: String?
|
var id: String?
|
||||||
var image_url: String?
|
var image_url: String?
|
||||||
var is_vip: Int?
|
var is_vip: Int?
|
||||||
|
@ -12,7 +12,7 @@ class SPEpisodeCell: SPCollectionViewCell {
|
|||||||
|
|
||||||
var videoInfoModel: SPVideoInfoModel? {
|
var videoInfoModel: SPVideoInfoModel? {
|
||||||
didSet {
|
didSet {
|
||||||
textLabel.text = "\(videoInfoModel?.episode ?? 0)"
|
textLabel.text = "\(videoInfoModel?.episode ?? "0")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ class SPEpisodeView: HWPanModalContentView {
|
|||||||
maxIndex = dataArr.count - 1
|
maxIndex = dataArr.count - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
let minEpisode = dataArr[minIndex].episode ?? 0
|
let minEpisode = dataArr[minIndex].episode ?? "0"
|
||||||
let maxEpisode = dataArr[maxIndex].episode ?? 0
|
let maxEpisode = dataArr[maxIndex].episode ?? "0"
|
||||||
|
|
||||||
if minEpisode == maxEpisode {
|
if minEpisode == maxEpisode {
|
||||||
menuDataArr.append("\(minEpisode)")
|
menuDataArr.append("\(minEpisode)")
|
||||||
|
@ -90,7 +90,7 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
|
|||||||
var videoInfo: SPVideoInfoModel? {
|
var videoInfo: SPVideoInfoModel? {
|
||||||
didSet {
|
didSet {
|
||||||
self.controlView.progress = 0
|
self.controlView.progress = 0
|
||||||
self.coverImageView.isHidden = false
|
// self.coverImageView.isHidden = false
|
||||||
self.controlView.currentTime = 0
|
self.controlView.currentTime = 0
|
||||||
self.controlView.durationTime = 0
|
self.controlView.durationTime = 0
|
||||||
|
|
||||||
@ -103,6 +103,11 @@ class SPPlayerListCell: SPCollectionViewCell, SPPlayerProtocol {
|
|||||||
var isCurrent: Bool = false {
|
var isCurrent: Bool = false {
|
||||||
didSet {
|
didSet {
|
||||||
controlView.isCurrent = isCurrent
|
controlView.isCurrent = isCurrent
|
||||||
|
if !isCurrent {
|
||||||
|
// self.player.replay()
|
||||||
|
self.player.seekToTime(toTime: 0)
|
||||||
|
self.coverImageView.isHidden = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,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))
|
||||||
self.player.assetURL = proxyURL
|
if proxyURL != self.player.assetURL {
|
||||||
|
self.player.assetURL = proxyURL
|
||||||
|
}
|
||||||
// self.prepare()
|
// self.prepare()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user