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:
2026-01-21 22:12:08 -06:00
commit 872354b834
283 changed files with 338296 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
@testable import KSPlayer
import XCTest
class KSPlayerLayerTest: XCTestCase {
private var readyToPlayExpectation: XCTestExpectation?
override func setUp() {
KSOptions.secondPlayerType = KSMEPlayer.self
KSOptions.isSecondOpen = true
KSOptions.isAccurateSeek = true
}
func testPlayerLayer() {
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)
}
}
func set(path: String) {
let options = KSOptions()
let playerLayer = KSPlayerLayer(url: URL(fileURLWithPath: path), options: options)
playerLayer.delegate = self
XCTAssertEqual(playerLayer.state, .preparing)
readyToPlayExpectation = expectation(description: "openVideo")
waitForExpectations(timeout: 2) { _ in
XCTAssert(playerLayer.player.isReadyToPlay == true)
XCTAssertEqual(playerLayer.state, .readyToPlay)
playerLayer.play()
playerLayer.pause()
XCTAssertEqual(playerLayer.state, .paused)
let seekExpectation = self.expectation(description: "seek")
playerLayer.seek(time: 2, autoPlay: true) { _ in
seekExpectation.fulfill()
}
XCTAssertEqual(playerLayer.state, .buffering)
self.waitForExpectations(timeout: 1000) { _ in
playerLayer.finish(player: playerLayer.player, error: nil)
XCTAssertEqual(playerLayer.state, .playedToTheEnd)
playerLayer.stop()
XCTAssertEqual(playerLayer.state, .initialized)
}
}
}
}
extension KSPlayerLayerTest: KSPlayerLayerDelegate {
func player(layer _: KSPlayerLayer, state: KSPlayerState) {
if state == .readyToPlay {
readyToPlayExpectation?.fulfill()
}
}
func player(layer _: KSPlayerLayer, currentTime _: TimeInterval, totalTime _: TimeInterval) {}
func player(layer _: KSPlayerLayer, finish _: Error?) {}
func player(layer _: KSPlayerLayer, bufferedCount: Int, consumeTime _: TimeInterval) {
if bufferedCount > 0 {
XCTFail()
}
}
}