播放器优化

This commit is contained in:
2025-04-21 15:35:15 +08:00
parent 33eab0225f
commit 6819c7c9ee
5 changed files with 25 additions and 15 deletions

View File

@ -11,9 +11,7 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1AC17585C566B70F526D3938 /* Pods-ShortPlay.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShortPlay.debug.xcconfig"; path = "Target Support Files/Pods-ShortPlay/Pods-ShortPlay.debug.xcconfig"; sourceTree = "<group>"; };
1DBC40592DA4EDFC0093FCB0 /* Thimra.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Thimra.app; sourceTree = BUILT_PRODUCTS_DIR; };
9DF7FB1047F612A65429345F /* Pods-ShortPlay.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShortPlay.release.xcconfig"; path = "Target Support Files/Pods-ShortPlay/Pods-ShortPlay.release.xcconfig"; sourceTree = "<group>"; };
EF2D7FDB1FE86E5CD9908162 /* Pods_Thimra.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Thimra.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F7763FEFB6BEB1A75D6FBA0A /* Pods-Thimra.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Thimra.debug.xcconfig"; path = "Target Support Files/Pods-Thimra/Pods-Thimra.debug.xcconfig"; sourceTree = "<group>"; };
FEA583158A7C05D8D7C5A9FC /* Pods-Thimra.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Thimra.release.xcconfig"; path = "Target Support Files/Pods-Thimra/Pods-Thimra.release.xcconfig"; sourceTree = "<group>"; };
@ -55,8 +53,6 @@
0061C3496D158807460301A9 /* Pods */ = {
isa = PBXGroup;
children = (
1AC17585C566B70F526D3938 /* Pods-ShortPlay.debug.xcconfig */,
9DF7FB1047F612A65429345F /* Pods-ShortPlay.release.xcconfig */,
F7763FEFB6BEB1A75D6FBA0A /* Pods-Thimra.debug.xcconfig */,
FEA583158A7C05D8D7C5A9FC /* Pods-Thimra.release.xcconfig */,
);

View File

@ -17,6 +17,8 @@ import UIKit
https://api-viontv.viontv.com/b7afef99/
https://api-zyreotv.zyreotv.com/7834f11d/
https://thimratv.com
*/
#if DEBUG

View File

@ -56,6 +56,9 @@ class SPPlayerListViewController: SPViewController {
///
var autoNextEpisode = false
///
private(set) var isFirstPlay = true
private(set) var viewModel = SPPlayerListViewModel()
private(set) var currentIndexPath = IndexPath(row: 0, section: 0)
@ -96,6 +99,7 @@ class SPPlayerListViewController: SPViewController {
NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActiveNotification), name: UIApplication.didBecomeActiveNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(willResignActiveNotification), name: UIApplication.willResignActiveNotification, object: nil)
sp_setupUI()
sp_addActio()
}
@ -159,6 +163,12 @@ class SPPlayerListViewController: SPViewController {
self.loadMoreData()
}
if isFirstPlay {
isFirstPlay = false
let offset = self.collectionView.contentOffset.y + 0.5
self.collectionView.setContentOffset(CGPoint(x: 0, y: offset), animated: false)
}
if currentIndexPath.row <= 2 {
// self.loadUpMoreData()
}
@ -183,6 +193,8 @@ class SPPlayerListViewController: SPViewController {
if !animated {
if self.currentIndexPath != indexPath {
self.skip(indexPath: indexPath)
} else {
self.play()
}
}
}
@ -323,7 +335,7 @@ extension SPPlayerListViewController: UICollectionViewDelegate, UICollectionView
let indexPaths = self.collectionView.indexPathsForVisibleItems
for indexPath in indexPaths {
guard let cell = self.collectionView.cellForItem(at: indexPath) else { continue }
if offsetY == cell.frame.origin.y {
if floor(offsetY) == floor(cell.frame.origin.y) {
if self.currentIndexPath != indexPath {
self.skip(indexPath: indexPath)
}

View File

@ -20,18 +20,18 @@ class NetworkObserver {
func startMonitoring() {
monitor.pathUpdateHandler = { path in
if path.status == .satisfied {
print("++++++Network is available")
print("++++++有网")
} else {
print("++++++No network connection")
print("++++++无网")
}
if path.usesInterfaceType(.wifi) {
print("++++++Using Wi-Fi")
}
if path.usesInterfaceType(.cellular) {
print("++++++Using Cellular")
}
// if path.usesInterfaceType(.wifi) {
// print("++++++Using Wi-Fi")
// }
//
// if path.usesInterfaceType(.cellular) {
// print("++++++Using Cellular")
// }
}
monitor.start(queue: queue)

View File

@ -8,7 +8,7 @@
#import "PDKeyChain.h"
static NSString * const kPDKeyChainKey = @"com.shortplay.keychainKey";
static NSString * const kPDKeyChainKey = @"com.thimra.keychainKey";
@implementation PDKeyChain