Files
simvision/KSPlayer-main/Tests/KSPlayerTests/KSAVPlayerTest.swift
Michael Simard 872354b834 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>
2026-01-21 22:12:08 -06:00

54 lines
1.7 KiB
Swift

@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()
}
}
}