无法在iPhone上播放音频(反应360)

时间:2019-01-22 02:11:10

标签: reactjs react-native web-audio virtual-reality react-360

我正在努力使音频在React 360上播放在手机上。通过阅读各种文档,我了解到,要在手机上播放音频,我需要制定一个html实体来创建用户相互作用。一旦用户通过单击按钮进行交互,音频就应该能够在移动设备上播放。似乎并非如此。

在我的index.html文件中,我有以下代码:

<html>
  <head>
    <title>ExampleVR</title>
    <style>body { margin: 0; }</style>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  </head>
  <body>
    <!-- Attachment point for your app -->

    <div id="container">


      <button id="enter" onclick="enterApp();">
        Click to Enter VR
      </button>


    </div>
    <script src="./client.bundle?platform=vr"></script>
    <script>
      // Initialize the React 360 application


      function enterApp() {
        React360.init(
          'index.bundle?platform=vr&dev=true',
          document.getElementById('container'),
          {
            assetRoot: 'static_assets/',
          }
        );  
      }


    </script>
  </body>
</html>

如您所见,我创建了一个html按钮,单击该按钮将加载我的React 360代码。但是,当我在移动设备中单击VrButton时,它仍然无法播放。我遵循了记录中的建议,它适用于台式机上的所有浏览器(移动设备除外)。有人知道如何解决此问题吗?

1 个答案:

答案 0 :(得分:1)

这是解决音频问题的解决方案:

https://github.com/facebook/react-360/issues/652