basic audio player working
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user