Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP GlassKit7// File : Examples/Gallery/Media/GlassVideoPlayerExample.swift8// Module : Examples9// Repository : https://git.spboucher.ai/sp-glasskit10// Project Website : https://glass.spboucher.ai11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI42import AVFoundation43import SPGlassKit4445public struct GlassVideoPlayerExample: GlassExample {46 public static let componentID = "glass-video-player"47 /// An empty player: the repository ships no media file, so the example shows the states without a video.48 @State private var emptyPlayer = AVPlayer()4950 public init() {}5152 public var body: some View {53 ScrollView {54 VStack(alignment: .leading, spacing: 16) {55 Text("No player")56 .font(.headline)57 GlassVideoPlayer(player: nil, accessibilityLabel: "Trailer")5859 Text("Player without an item, 4:3")60 .font(.headline)61 GlassVideoPlayer(player: emptyPlayer, aspectRatio: 4.0 / 3.0, accessibilityLabel: "Lecture recording")6263 Text("Missing URL")64 .font(.headline)65 GlassVideoPlayer(url: nil)6667 Text("Sample data · give the player a real URL to see the system controls.")68 .font(.caption)69 .foregroundStyle(.secondary)70 }71 .padding()72 }73 }74}7576#Preview("GlassVideoPlayer") { GlassVideoPlayerExample().glassTheme(.obsidian) }77