How to make MPMoviePlayerController ignore the mute switch

后端 未结 5 1877
無奈伤痛
無奈伤痛 2021-02-07 02:21

I want to play a video using MPMoviePlayerController but I want it to ignore the mute switch, similar to the behavior of Youtube\'s video player.

Any ideas?

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 02:47

    in Swift: Do this once before you play sound/video (for example at the beginning of your application)

    do{
      try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
    } catch {
      //Didn't work
    }
    

提交回复
热议问题