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
+4 -4
View File
@@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSContactsUsageDescription</key>
<string>Please provide access to build your inner circle 🌱</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
@@ -19,7 +17,9 @@
<array>
<string>Satisfy-Regular.ttf</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
</dict>
</plist>
@@ -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()
}
}