<small id='3s153'></small><noframes id='3s153'>

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

      1. 如何在 UIWebView 中播放 youtube 视频静音?

        时间:2023-10-21
        <tfoot id='gWdL4'></tfoot>
          <tbody id='gWdL4'></tbody>

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

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

                • <bdo id='gWdL4'></bdo><ul id='gWdL4'></ul>
                  <i id='gWdL4'><tr id='gWdL4'><dt id='gWdL4'><q id='gWdL4'><span id='gWdL4'><b id='gWdL4'><form id='gWdL4'><ins id='gWdL4'></ins><ul id='gWdL4'></ul><sub id='gWdL4'></sub></form><legend id='gWdL4'></legend><bdo id='gWdL4'><pre id='gWdL4'><center id='gWdL4'></center></pre></bdo></b><th id='gWdL4'></th></span></q></dt></tr></i><div id='gWdL4'><tfoot id='gWdL4'></tfoot><dl id='gWdL4'><fieldset id='gWdL4'></fieldset></dl></div>
                • 本文介绍了如何在 UIWebView 中播放 youtube 视频静音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 UIWebView 在 iOS 9 for iphone 上播放嵌入的 youtube 视频.

                  I am using UIWebView to play an embedded youtube video, on iOS 9 for iphone.

                  但是,由于一个已知问题,音量控制不起作用,即调用 player.mute() 或 player.setVolume(0) 根本不起作用:https://github.com/youtube/youtube-ios-player-helper/问题/20

                  However, due to a known issue, the volume control is not working, i.e. calling player.mute() or player.setVolume(0) doesn't work at all: https://github.com/youtube/youtube-ios-player-helper/issues/20

                  我想知道是否有人成功解决了这个问题?能否分享一下你的方法.

                  I am wondering if anyone has successfully worked around this? Could you share your method.

                  我正在使用的示例嵌入式 html:

                  The sample embedded html I am using:

                      <html><body style='margin:0px;padding:0px;'>  
                      <script type='text/javascript' src='http://www.youtube.com/iframe_api'></script><script type='text/javascript'>
                      var player;
                      function onYouTubeIframeAPIReady()
                      {player=new YT.Player('playerId',{events:{onReady:onPlayerReady}})}
                      function onPlayerReady(event){player.mute();player.setVolume(0);player.playVideo();}
                      </script>
                      <iframe id='playerId' type='text/html' width='1280' height='720' 
                  src='https://www.youtube.com/embed/R52bof3tvZs?enablejsapi=1&rel=0&playsinline=1&autoplay=1&showinfo=0&autohide=1&controls=0&modestbranding=1' frameborder='0'>
                      </body></html>
                  

                  谢谢!

                  推荐答案

                  首先不能使用javascript设置音量检查this doc 并阅读 Volume Control inJavaScript 部分.在这里找到.

                  First of all you cannot set the volume using javascript check this doc and read Volume Control in JavaScript section. Found here.

                  第二次我尝试了这个:

                  [[NSNotificationCenter defaultCenter] addObserver:self
                                                           selector:@selector(playerItemBecameCurrentNotif:)
                                                               name:@"AVPlayerItemBecameCurrentNotification"
                                                             object:nil];
                  
                  
                  - (void)playerItemBecameCurrentNotif:(NSNotification*)notification {
                      AVPlayerItem *playerItem = notif.object;
                      AVPlayer *player = [playerItem valueForKey:@"player"];
                      [player setVolume:0.0];
                  }
                  

                  这似乎在模拟器中运行良好.但是,此方法使用了一些私有属性.使用风险自负;)并且不要忘记删除观察者.

                  This seems to be working fine in simulator. However this method is using some private properties. Use at your own risk ;) and don't forget to remove observer.

                  这篇关于如何在 UIWebView 中播放 youtube 视频静音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Swift UIWebView 不加载 http 网站 下一篇:iphone uiwebview 程序化缩放

                  相关文章

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

                  <tfoot id='qNRai'></tfoot>
                • <legend id='qNRai'><style id='qNRai'><dir id='qNRai'><q id='qNRai'></q></dir></style></legend>

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