在触发的声音上反应本地视频暂停

时间:2020-04-17 16:34:15

标签: react-native react-native-sound

我有一个React Native应用,该应用具有嵌入式Twitch流视频/音频:

<iframe
  src="${uri}"
  height="${height}"
  width="${width}"
  frameborder="0"
  scrolling="no"
  allowfullscreen="false"
  style="margin: 0; padding: 0;"
  />
  </body>
  </html>
  `;
  return (
    <WebView
      source={{
        html: iframeMarkup,
      }}
      automaticallyAdjustContentInsets={true}
      scalesPageToFit={true}
      style={[styles, style]}
      allowsInlineMediaPlayback={true}
    />
  );

当用户执行操作时,我们还将通过React-Native-Sound-Player播放短声音文件:

   try {
    SoundPlayer.playSoundFile('win', 'wav');
  } catch (e) {
    console.log(`cannot play the sound file`, e);
  }

但是,当iOS用户触发声音时,它将暂停嵌入式Twitch视频。有办法解决吗?

0 个答案:

没有答案
相关问题