Play Audio when device in silent mode - ios swift

前端 未结 8 1897
无人及你
无人及你 2020-12-23 16:58

I am creating an application using xcode 7.1, swift. I want to play an audio. Everything is fine. Now my problem I want to hear sound when the device in silent mode or muted

8条回答
  •  感动是毒
    2020-12-23 17:26

    Swift 4

    use this line before play video

    try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
    

提交回复
热议问题