Initial commit
This commit is contained in:
28
mlbTVOS/mlbTVOSApp.swift
Normal file
28
mlbTVOS/mlbTVOSApp.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
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)")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user