gpt4 book ai didi

ios - 在 iPhone 上播放视频时没有声音,而铃声是静音的。使用 YouTube-Player-iOS-Helper

转载 作者:行者123 更新时间:2023-11-29 11:43:00 25 4
gpt4 key购买 nike

我已经使用 pod youtube-iso-player-helper 将 YTPlayer 集成到我的 native iOS 应用程序中。

我面临的问题是,当 iPhone 的铃声无声时,我在播放视频时听不到任何声音,它与耳机配合使用正常,但在 iPhone 扬声器上不起作用。

注意:我没有将 iPhone 音量调成静音,它只是铃声静音。

最佳答案

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

关于ios - 在 iPhone 上播放视频时没有声音,而铃声是静音的。使用 YouTube-Player-iOS-Helper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45430571/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com