SPB Git

Repository Public MIT

example-glass-video-player.txt 1.2 KB 37 lines text

1import SwiftUI2import AVFoundation3import SPGlassKit45public struct GlassVideoPlayerExample: GlassExample {6    public static let componentID = "glass-video-player"7    /// An empty player: the repository ships no media file, so the example shows the states without a video.8    @State private var emptyPlayer = AVPlayer()910    public init() {}1112    public var body: some View {13        ScrollView {14            VStack(alignment: .leading, spacing: 16) {15                Text("No player")16                    .font(.headline)17                GlassVideoPlayer(player: nil, accessibilityLabel: "Trailer")1819                Text("Player without an item, 4:3")20                    .font(.headline)21                GlassVideoPlayer(player: emptyPlayer, aspectRatio: 4.0 / 3.0, accessibilityLabel: "Lecture recording")2223                Text("Missing URL")24                    .font(.headline)25                GlassVideoPlayer(url: nil)2627                Text("Sample data · give the player a real URL to see the system controls.")28                    .font(.caption)29                    .foregroundStyle(.secondary)30            }31            .padding()32        }33    }34}3536#Preview("GlassVideoPlayer") { GlassVideoPlayerExample().glassTheme(.obsidian) }37
Files main
Menu

Theme