basic audio player working

This commit is contained in:
talksik
2021-12-18 22:08:26 -08:00
parent 4cf0a44e79
commit 5c02fdac6b
3 changed files with 48 additions and 4 deletions
@@ -0,0 +1,30 @@
//
// AudioPlayer.swift
// nirvana-ios
//
// Created by Arjun Patel on 12/18/21.
//
import SwiftUI
import AVKit
struct AudioPlayerView: View {
@State var player = AVPlayer()
var audioUrl: URL? = URL(string: "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
var body: some View {
Text("we should here the music play")
.onAppear() {
player = AVPlayer(url: audioUrl!)
player.play()
}
}
}
struct AudioPlayerView_Previews: PreviewProvider {
static var previews: some View {
AudioPlayerView()
}
}