Siddharth Sunil
Siddharth Sunil

Reputation: 233

There is no audio when video is played while ringer is silent on iPhone. using YouTube-Player-iOS-Helper

I have used pod youtube-iso-player-helper to integrate YTPlayer within my native iOS application.

The issue, I am facing, is I am not able to hear any sound while the video is being played when the iPhone that has ringer silent & it works fine with earphone but does not work on iPhone speakers.

Note: I have not muted the iPhone volume, it's only ringer silent.

Upvotes: 1

Views: 1013

Answers (2)

R.Chauhan
R.Chauhan

Reputation: 51

[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];

Upvotes: 1

Berlin Raj
Berlin Raj

Reputation: 124

Objective C:

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive:YES error:nil];
playerView.webView.mediaPlaybackRequiresUserAction = NO; 

Swift

let audioSession = AVAudioSession.sharedInstance()
do {
    try audioSession.setCategory(AVAudioSessionCategoryPlayback)
    try audioSession.setActive(true)
} catch {

}

playerView.webView?.mediaPlaybackRequiresUserAction = false

Upvotes: 1

Related Questions