AudioPlayerView

struct AudioPlayerView : View

SwiftUI View for the audio player

  • The music URL

    Declaration

    Swift

    let musicURL: URL
  • The AVAudioPlayer

    Declaration

    Swift

    @State
    private var audioPlayer: AVAudioPlayer? { get nonmutating set }
  • Bool if the player is playing or not

    Declaration

    Swift

    @State
    private var isPlaying: Bool { get nonmutating set }
  • The FileBrowser model

    Declaration

    Swift

    @EnvironmentObject
    var fileBrowser: FileBrowser { get }
  • The status of the song

    Declaration

    Swift

    @State
    private var status: Status { get nonmutating set }
  • The iCloud URL of the song

    Declaration

    Swift

    private var iCloudURL: URL { get }
  • Show an Alert if the music file is not found

    Declaration

    Swift

    @State
    private var errorAlert: AlertMessage? { get nonmutating set }
  • Show an ConfirmationDialog if the music file is not downloaded

    Declaration

    Swift

    @State
    private var confirmationDialog: AlertMessage? { get nonmutating set }

Body of the View

  • The body of the View

    Declaration

    Swift

    var body: some View { get }

Additional View parts

  • The play button

    Declaration

    Swift

    @ViewBuilder
    var playButton: some View { get }
  • The pause button

    Declaration

    Swift

    @ViewBuilder
    var pauseButton: some View { get }

Prive functions

  • checkSong() Asynchronous

    Check the song file

    Declaration

    Swift

    @MainActor
    private func checkSong() async
  • Play the song file

    Declaration

    Swift

    private func playSong()
  • downloadSong() Asynchronous

    Download the song

    Declaration

    Swift

    private func downloadSong() async