Initial commit: SimVision tvOS streaming app
Features: - VOD library with movie grouping and version detection - TV show library with season/episode organization - TMDB integration for trending shows and recently aired episodes - Recent releases section with TMDB release date sorting - Watch history tracking with continue watching - Playlist caching (12-hour TTL) for offline support - M3U playlist parsing with XStream API support - Authentication with credential storage Technical: - SwiftUI for tvOS - Actor-based services for thread safety - Persistent caching for playlists, TMDB data, and watch history - KSPlayer integration for video playback Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
53
KSPlayer-main/Tests/KSPlayerTests/KSAVPlayerTest.swift
Normal file
53
KSPlayer-main/Tests/KSPlayerTests/KSAVPlayerTest.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
@testable import KSPlayer
|
||||
import XCTest
|
||||
|
||||
class KSAVPlayerTest: XCTestCase {
|
||||
private var readyToPlayExpectation: XCTestExpectation?
|
||||
@MainActor
|
||||
func testPlayer() {
|
||||
if let path = Bundle(for: type(of: self)).path(forResource: "h264", ofType: "MP4") {
|
||||
set(path: path)
|
||||
}
|
||||
// if let path = Bundle(for: type(of: self)).path(forResource: "google-help-vr", ofType: "mp4") {
|
||||
// set(path: path)
|
||||
// }
|
||||
if let path = Bundle(for: type(of: self)).path(forResource: "mjpeg", ofType: "flac") {
|
||||
set(path: path)
|
||||
}
|
||||
if let path = Bundle(for: type(of: self)).path(forResource: "hevc", ofType: "mkv") {
|
||||
set(path: path)
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func set(path: String) {
|
||||
let play = KSAVPlayer(url: URL(fileURLWithPath: path), options: KSOptions())
|
||||
play.delegate = self
|
||||
play.prepareToPlay()
|
||||
readyToPlayExpectation = expectation(description: "openVideo")
|
||||
waitForExpectations(timeout: 10) { _ in
|
||||
if play.isReadyToPlay {
|
||||
play.play()
|
||||
}
|
||||
play.shutdown()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension KSAVPlayerTest: MediaPlayerDelegate {
|
||||
func readyToPlay(player _: some MediaPlayerProtocol) {
|
||||
readyToPlayExpectation?.fulfill()
|
||||
}
|
||||
|
||||
func changeLoadState(player _: some MediaPlayerProtocol) {}
|
||||
|
||||
func changeBuffering(player _: some MediaPlayerProtocol, progress _: Int) {}
|
||||
|
||||
func playBack(player _: some MediaPlayerProtocol, loopCount _: Int) {}
|
||||
|
||||
func finish(player _: some MediaPlayerProtocol, error: Error?) {
|
||||
if error != nil {
|
||||
readyToPlayExpectation?.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user