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>
45 lines
1.5 KiB
Swift
45 lines
1.5 KiB
Swift
@testable import KSPlayer
|
|
import XCTest
|
|
|
|
class KSMEPlayerTest: XCTestCase {
|
|
@MainActor
|
|
func testPlaying() {
|
|
if let path = Bundle(for: type(of: self)).path(forResource: "h264", ofType: "mp4") {
|
|
let options = KSOptions()
|
|
let player = KSMEPlayer(url: URL(fileURLWithPath: path), options: options)
|
|
player.delegate = self
|
|
XCTAssertEqual(player.isPlaying, false)
|
|
player.play()
|
|
XCTAssertEqual(player.isPlaying, true)
|
|
player.pause()
|
|
XCTAssertEqual(player.isPlaying, false)
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
func testAutoPlay() {
|
|
if let path = Bundle(for: type(of: self)).path(forResource: "h264", ofType: "mp4") {
|
|
let options = KSOptions()
|
|
let player = KSMEPlayer(url: URL(fileURLWithPath: path), options: options)
|
|
player.delegate = self
|
|
XCTAssertEqual(player.isPlaying, false)
|
|
player.play()
|
|
XCTAssertEqual(player.isPlaying, true)
|
|
player.pause()
|
|
XCTAssertEqual(player.isPlaying, false)
|
|
}
|
|
}
|
|
}
|
|
|
|
extension KSMEPlayerTest: MediaPlayerDelegate {
|
|
func readyToPlay(player _: some KSPlayer.MediaPlayerProtocol) {}
|
|
|
|
func changeLoadState(player _: some KSPlayer.MediaPlayerProtocol) {}
|
|
|
|
func changeBuffering(player _: some KSPlayer.MediaPlayerProtocol, progress _: Int) {}
|
|
|
|
func playBack(player _: some KSPlayer.MediaPlayerProtocol, loopCount _: Int) {}
|
|
|
|
func finish(player _: some KSPlayer.MediaPlayerProtocol, error _: Error?) {}
|
|
}
|