import SwiftUI
import KSPlayer

// Wrapper to configure KSPlayer with our default options
struct KSVideoPlayerView: View {
    let streamURL: URL

    var body: some View {
        // Use KSPlayer's KSVideoPlayerView directly with convenience initializer
        KSPlayer.KSVideoPlayerView(url: streamURL, options: makeOptions())
            .onAppear {
                print("🎬 KSPlayer initialized for URL: \(streamURL)")
            }
    }

    private func makeOptions() -> KSOptions {
        let options = KSOptions()
        KSOptions.isAutoPlay = true
        KSOptions.isLoopPlay = false
        KSOptions.hardwareDecode = true
        return options
    }
}
