Reputation: 233
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
Reputation: 51
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
Upvotes: 1
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