-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswiftui_loop_videoplayer_exampleApp.swift
49 lines (39 loc) · 1.25 KB
/
swiftui_loop_videoplayer_exampleApp.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// swiftui_loop_videoplayer_exampleApp.swift
//
// Created by Igor Shelopaev on 03.07.2023.
//
import SwiftUI
import AVFAudio
@main
struct swiftui_loop_videoplayer_exampleApp: App {
/// Delegate for processing notifications and events of app level
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
.accessibilityIdentifier("ContentView")
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
/// Application enter point
/// - Parameters:
/// - application: app
/// - launchOptions: launch params
/// - Returns: State
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
setupAudio()
return true
}
/// Setup audio params
func setupAudio() {
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(AVAudioSession.Category.playback, mode: AVAudioSession.Mode.default, options: [.mixWithOthers])
try audioSession.setActive(true)
} catch {
print("something went wrong")
}
}
}