here is all my codes for play a mp4,the mp4 is playing but no sounds out
import UIKit
import AVFoundation
class ViewController: UIViewController {
@IBOutl
I had multiple view controllers that needed to play audio even when the device what set to mute. So instead of updating every single viewDidLoad
, I added the following to the didFinishLaunchingWithOptions
method in the AppDelegate.swift file.
try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
Notes:
AVFoundation
try?
.