in Broadcasting/BroadcastViewModel.swift [151:168]
func toggleBroadcastSession() {
if let session = broadcastSession, sessionIsRunning {
session.stop()
UIApplication.shared.isIdleTimerDisabled = false
} else {
initializeBroadcastSession()
do {
guard let url = URL(string: ingestServer) else {
print("Ingest server not set or invalid")
return
}
try broadcastSession?.start(with: url, streamKey: streamKey)
UIApplication.shared.isIdleTimerDisabled = true
} catch {
print("❌ Error starting IVSBroadcastSession: \(error)")
}
}
}