{
  "accessibility" : [
    "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.",
    "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.",
    "Elapsed and remaining times are labelled; they use monospaced digits and Dynamic Type.",
    "Space toggles play and pause with a hardware keyboard.",
    "With Reduce Transparency the surface becomes opaque (handled by `glassSurface`)."
  ],
  "category" : "media",
  "changelog" : [
    {
      "changes" : [
        "Release 1.1.0: see the project changelog."
      ],
      "date" : "2026-12-03",
      "version" : "1.1.0"
    },
    {
      "changes" : [
        "Initial release."
      ],
      "date" : "2026-12-02",
      "version" : "1.0.0"
    }
  ],
  "dependencies" : [
    {
      "id" : "glass-foundation",
      "version" : "1.1.0"
    },
    {
      "id" : "glass-media-support",
      "version" : "1.1.0"
    },
    {
      "id" : "glass-waveform",
      "version" : "1.1.0"
    }
  ],
  "description" : "Audio transport with play, pause, seek, times and interruption handling; never starts by itself.",
  "examples" : [
    {
      "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    /// Amplitudes of a fictitious recording, aggregated once.\n    private static let waveform = GlassWaveformData(samples: GlassWaveformExample.syntheticSamples(count: 9_600), maxBuckets: 64)\n\n    public init() {}\n\n    public var body: some View {\n        VStack(spacing: 16) {\n            GlassAudioPlayer(playback: playback, title: \"Harbour Lines\", subtitle: \"Sample data · simulated clock, no audio\", artwork: SampleArtwork.image(1))\n            GlassAudioPlayer(playback: playback, title: \"Harbour Lines\", subtitle: \"With a waveform as the seek track\", skipInterval: 30, waveform: Self.waveform)\n            GlassAudioPlayer(playback: playback, title: \"Harbour Lines\", subtitle: \"Compact\", artwork: SampleArtwork.image(1), style: .compact)\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",
      "title" : "GlassAudioPlayer example"
    }
  ],
  "files" : [
    {
      "bytes" : 14378,
      "path" : "Media/Media/GlassAudioPlayer.swift",
      "sha256" : "803e3f2757fa1e813bc5f3065e5d8b41716342d5c6579a2da1d257ff4b401260"
    }
  ],
  "frameworks" : [
    "AVFoundation"
  ],
  "id" : "glass-audio-player",
  "kind" : "custom-glass",
  "license" : "MIT",
  "minimumOS" : {
    "iOS" : "26.0",
    "iPadOS" : "26.0",
    "macOS" : "26.0"
  },
  "name" : "GlassAudioPlayer",
  "platforms" : [
    "iOS",
    "iPadOS",
    "macOS"
  ],
  "schemaVersion" : 1,
  "sha256" : "0438c7ec628d26aa661a2db9868da2599d1b06070a8bf4e0bf61cdacf79bd8fe",
  "symbols" : [
    "GlassAudioPlayerStyle",
    "GlassAudioPlayer",
    "GlassAudioPlayerSymbols"
  ],
  "version" : "1.1.0"
}
