<legend id='cRA45'><style id='cRA45'><dir id='cRA45'><q id='cRA45'></q></dir></style></legend>

    1. <small id='cRA45'></small><noframes id='cRA45'>

      <i id='cRA45'><tr id='cRA45'><dt id='cRA45'><q id='cRA45'><span id='cRA45'><b id='cRA45'><form id='cRA45'><ins id='cRA45'></ins><ul id='cRA45'></ul><sub id='cRA45'></sub></form><legend id='cRA45'></legend><bdo id='cRA45'><pre id='cRA45'><center id='cRA45'></center></pre></bdo></b><th id='cRA45'></th></span></q></dt></tr></i><div id='cRA45'><tfoot id='cRA45'></tfoot><dl id='cRA45'><fieldset id='cRA45'></fieldset></dl></div>

        <bdo id='cRA45'></bdo><ul id='cRA45'></ul>

    2. <tfoot id='cRA45'></tfoot>
    3. 在 IOS 的 UIWebView 中播放 youtube 视频时设备中没有声音的问题

      Issue with not getting sound in device when play youtube video in UIWebView in IOS(在 IOS 的 UIWebView 中播放 youtube 视频时设备中没有声音的问题)

        <bdo id='yPpQb'></bdo><ul id='yPpQb'></ul>
        <tfoot id='yPpQb'></tfoot>
            <tbody id='yPpQb'></tbody>
        • <i id='yPpQb'><tr id='yPpQb'><dt id='yPpQb'><q id='yPpQb'><span id='yPpQb'><b id='yPpQb'><form id='yPpQb'><ins id='yPpQb'></ins><ul id='yPpQb'></ul><sub id='yPpQb'></sub></form><legend id='yPpQb'></legend><bdo id='yPpQb'><pre id='yPpQb'><center id='yPpQb'></center></pre></bdo></b><th id='yPpQb'></th></span></q></dt></tr></i><div id='yPpQb'><tfoot id='yPpQb'></tfoot><dl id='yPpQb'><fieldset id='yPpQb'></fieldset></dl></div>
            1. <small id='yPpQb'></small><noframes id='yPpQb'>

            2. <legend id='yPpQb'><style id='yPpQb'><dir id='yPpQb'><q id='yPpQb'></q></dir></style></legend>
              • 本文介绍了在 IOS 的 UIWebView 中播放 youtube 视频时设备中没有声音的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 UIWebView 播放 Yoytube 视频.
                我的代码是这样的

                I am using a UIWebView to play Yoytube Video.
                My code is like that

                self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0,320, 240)];
                [self.webView setBackgroundColor:[UIColor clearColor]];
                [self.webView setOpaque:NO];
                self.webView.delegate=self;
                [self.webView setAllowsInlineMediaPlayback:YES];
                [self.webView setMediaPlaybackRequiresUserAction:NO];
                [self.viewContent addSubview:self.webView];
                
                NSString* embedHTML = [NSString stringWithFormat:@"
                                                   <html>
                                                   <body style='margin:0px;padding:0px;'>
                                                   <script type='text/javascript' src='http://www.youtube.com/iframe_api'></script>
                                                   <script type='text/javascript'>
                                                   function onYouTubeIframeAPIReady()
                                                   {
                                                   ytplayer=new YT.Player('playerId',{events:{onReady:onPlayerReady}})
                                                   }
                                                   function onPlayerReady(a)
                                                   { 
                                                   a.target.playVideo(); 
                                                   }
                                                   </script>
                                                   <iframe id='playerId' type='text/html' width='%d' height='%d' src='http://www.youtube.com/embed/%@?enablejsapi=1&rel=0&playsinline=1&autoplay=1' frameborder='0'>
                                                   </body>
                                                   </html>", 320, 240, [dictIW valueForKey:@"embedCode"]];
                [self.webView loadHTMLString:embedHTML baseURL:[[NSBundle mainBundle] resourceURL]];
                

                在模拟器中玩得非常好.但是当我在 iPhone 或 iPad 上播放此视频时,视频正在播放,但声音却没有.
                请帮忙.

                In Simulator it is playing absolutely fine. But when I play this video in iPhone or iPad, the video is showing, but the sound is not getting.
                please help.

                推荐答案

                在创建 UIWebView 之前将音频会话类别设置为播放"

                Set the audio session category to 'playback' before creating the UIWebView

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

                这篇关于在 IOS 的 UIWebView 中播放 youtube 视频时设备中没有声音的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                iOS UIWebView app opens link in Safari(iOS UIWebView 应用在 Safari 中打开链接)
                Close UIWebView using javascript:window.close();(使用 javascript:window.close() 关闭 UIWebView;)
                NSCachedURLResponse returns object, but UIWebView does not interprets content(NSCachedURLResponse 返回对象,但 UIWebView 不解释内容)
                Trouble hiding iAd banner and displaying UIWebView in its place(无法隐藏 iAd 横幅并在其位置显示 UIWebView)
                Knowing when AJAX has loaded in UIWebView(知道何时在 UIWebView 中加载了 AJAX)
                Load image/logo in existing HTML input field - UIWebView(在现有的 HTML 输入字段中加载图像/徽标 - UIWebView)
                  <bdo id='opuV1'></bdo><ul id='opuV1'></ul>
                  <i id='opuV1'><tr id='opuV1'><dt id='opuV1'><q id='opuV1'><span id='opuV1'><b id='opuV1'><form id='opuV1'><ins id='opuV1'></ins><ul id='opuV1'></ul><sub id='opuV1'></sub></form><legend id='opuV1'></legend><bdo id='opuV1'><pre id='opuV1'><center id='opuV1'></center></pre></bdo></b><th id='opuV1'></th></span></q></dt></tr></i><div id='opuV1'><tfoot id='opuV1'></tfoot><dl id='opuV1'><fieldset id='opuV1'></fieldset></dl></div>

                  <small id='opuV1'></small><noframes id='opuV1'>

                      <tbody id='opuV1'></tbody>

                    1. <tfoot id='opuV1'></tfoot>
                    2. <legend id='opuV1'><style id='opuV1'><dir id='opuV1'><q id='opuV1'></q></dir></style></legend>