SPB Git

Repository Public MIT

manifest.json 3.9 KB 68 lines json

1{2  "accessibility" : [3    "Every button has a label (\"Play\", \"Pause\", \"Skip back\", \"Skip forward\") and a tooltip on macOS; hit targets are at least 44 points on iOS.",4    "The slider is labelled \"Playback position\" and its value is spoken as \"1:05 of 3:20\"; it is adjustable with the standard VoiceOver gestures.",5    "Elapsed and remaining times are labelled; they use monospaced digits and Dynamic Type.",6    "Space toggles play and pause with a hardware keyboard.",7    "With Reduce Transparency the surface becomes opaque (handled by `glassSurface`)."8  ],9  "category" : "media",10  "changelog" : [11    {12      "changes" : [13        "Initial release."14      ],15      "date" : "2026-12-02",16      "version" : "1.0.0"17    }18  ],19  "dependencies" : [20    {21      "id" : "glass-foundation",22      "version" : "1.0.0"23    },24    {25      "id" : "glass-media-support",26      "version" : "1.0.0"27    }28  ],29  "description" : "Audio transport with play, pause, seek, times and interruption handling; never starts by itself.",30  "examples" : [31    {32      "code" : "import SwiftUI\nimport SPGlassKit\n\n/// A silent playback engine for the example: it only moves a clock, no audio is produced.\n@MainActor\n@Observable\nfinal class SampleAudioPlayback: GlassAudioPlayback {\n    private(set) var isPlaying = false\n    private(set) var currentTime: TimeInterval = 42\n    let duration: TimeInterval\n    let isAvailable: Bool\n\n    init(duration: TimeInterval = 215, isAvailable: Bool = true) {\n        self.duration = duration\n        self.isAvailable = isAvailable\n    }\n\n    func play() {\n        guard isAvailable else { return }\n        if currentTime >= duration { currentTime = 0 }\n        isPlaying = true\n    }\n\n    func pause() { isPlaying = false }\n\n    func seek(to time: TimeInterval) {\n        currentTime = GlassPlaybackMath.clampedSeek(time, duration: duration)\n    }\n\n    /// Advances the simulated clock; called by the example while \"playing\".\n    func advance(by seconds: TimeInterval) {\n        currentTime = GlassPlaybackMath.clampedSeek(currentTime + seconds, duration: duration)\n        if currentTime >= duration { isPlaying = false }\n    }\n}\n\npublic struct GlassAudioPlayerExample: GlassExample {\n    public static let componentID = \"glass-audio-player\"\n    @State private var playback = SampleAudioPlayback()\n    @State private var unavailable = SampleAudioPlayback(duration: 0, isAvailable: false)\n\n    public init() {}\n\n    public var body: some View {\n        VStack(spacing: 16) {\n            GlassAudioPlayer(playback: playback, title: \"Morning Tide\", subtitle: \"Sample data · simulated clock, no audio\")\n            GlassAudioPlayer(playback: unavailable, title: \"Missing recording\", skipInterval: 30)\n        }\n        .padding()\n        .task(id: playback.isPlaying) {\n            // The fake engine has no audio clock: tick it while it is \"playing\".\n            while playback.isPlaying, !Task.isCancelled {\n                try? await Task.sleep(for: .milliseconds(500))\n                if !Task.isCancelled { playback.advance(by: 0.5) }\n            }\n        }\n    }\n}\n\n#Preview(\"GlassAudioPlayer\") { GlassAudioPlayerExample().glassTheme(.ocean) }\n",33      "title" : "GlassAudioPlayer example"34    }35  ],36  "files" : [37    {38      "bytes" : 8427,39      "path" : "Media/Media/GlassAudioPlayer.swift",40      "sha256" : "855f9b01d1eb97b74324542f70cbd28981e0b9832f76b3b502c4e9d3c7244e92"41    }42  ],43  "frameworks" : [44    "AVFoundation"45  ],46  "id" : "glass-audio-player",47  "kind" : "custom-glass",48  "license" : "MIT",49  "minimumOS" : {50    "iOS" : "26.0",51    "iPadOS" : "26.0",52    "macOS" : "26.0"53  },54  "name" : "GlassAudioPlayer",55  "platforms" : [56    "iOS",57    "iPadOS",58    "macOS"59  ],60  "schemaVersion" : 1,61  "sha256" : "3a1bab91b92f7fd7dd138f40f0448bf72173b99389baed533e3fd12d2599e4db",62  "symbols" : [63    "GlassAudioPlayer",64    "GlassAudioPlayerSymbols"65  ],66  "version" : "1.0.0"67}68
Files main
Menu

Theme