29 lines
720 B
Swift
29 lines
720 B
Swift
|
//
|
||
|
// AudioSessionHelper.swift
|
||
|
// Tusker
|
||
|
//
|
||
|
// Created by Shadowfacts on 6/21/20.
|
||
|
// Copyright © 2020 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
import AVFoundation
|
||
|
|
||
|
struct AudioSessionHelper {
|
||
|
static func enable() {
|
||
|
try? AVAudioSession.sharedInstance().setActive(true, options: [])
|
||
|
}
|
||
|
|
||
|
static func disable() {
|
||
|
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
|
||
|
}
|
||
|
|
||
|
static func setDefault() {
|
||
|
try? AVAudioSession.sharedInstance().setCategory(.playback, options: .mixWithOthers)
|
||
|
}
|
||
|
|
||
|
static func setVideoPlayback() {
|
||
|
try? AVAudioSession.sharedInstance().setCategory(.playback, options: [])
|
||
|
}
|
||
|
}
|