29 lines
657 B
Swift
29 lines
657 B
Swift
import AVFoundation
|
|
import SwiftUI
|
|
|
|
@main
|
|
struct mlbTVOSApp: App {
|
|
@State private var viewModel = GamesViewModel()
|
|
|
|
init() {
|
|
configureAudioSession()
|
|
}
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
ContentView()
|
|
.environment(viewModel)
|
|
}
|
|
}
|
|
|
|
private func configureAudioSession() {
|
|
// Start with .ambient so we don't interrupt other audio on launch
|
|
// Switch to .playback when user starts a stream
|
|
do {
|
|
try AVAudioSession.sharedInstance().setCategory(.ambient)
|
|
} catch {
|
|
print("Failed to set audio session: \(error)")
|
|
}
|
|
}
|
|
}
|