1
votes

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.

2
iPhone OS Version - karthikeyan

2 Answers

1
votes

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
1
votes

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