嵌入式UIWebView YouTube音量 [英] Embedded UIWebView YouTube Volume

查看:180
本文介绍了嵌入式UIWebView YouTube音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用可在UIWebView中显示YouTube影片的iOS应用程式。一切都很好,除非...

I'm working on an iOS app that can display YouTube videos in a UIWebView. Everything is working great except...

第一次播放视频时,它以〜10%的音量播放。设备音量设置为100%,播放器音量在UI中显示为100%。退出网络视图并使用我们的原生流媒体播放器在应用中播放歌曲,然后返回到播放的视频的音量正确。

The first time a video is played it plays at ~10% volume. The device volume is set at 100% and the player volume shows 100% in the UI. Backing out of the web view and play a song in the app using our native streaming player then go back to the video it plays at the correct volume.

t工作...

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[MPMusicPlayerController applicationMusicPlayer] setVolume:1.0];
}







- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[MPMusicPlayerController iPodMusicPlayer] setVolume:1.0];
}

两个调用都只是在屏幕上刷新音量改变的UI,

Both calls just flash the volume changed UI on screen and do nothing for the WebView volume.

推荐答案

如果您有任何想法,

经过一些更多的研究,我只需要从内置的音频播放器设置回放类型。

After some more research I just needed to set the playback type back from the built in audio player.

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
BOOL ok;
NSError *setCategoryError = nil;
ok = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];

沿着这些线。

这篇关于嵌入式UIWebView YouTube音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆