HarmonyOS RNOH react-native-webview H5页面的音频无法播放

RNOH react-native-webview H5页面的音频无法播放。

HarmonyOS
2024-12-25 17:42:06
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
fox280
import React, {useEffect} from 'react';
import {View} from 'react-native';
import WebView from 'react-native-webview';
const Demo = () => {
  return <View style={{flex: 1}}>
  <WebView
startInLoadingState={true}
domStorageEnabled={true}
style={{flex: 1, backgroundColor: 'red'}}
source={{uri: 'xxxx'}}/>
  </View>
}
export default Demo
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

解决方案

尝试加上ignoreSilentHardwareSwitch={true}。

<View style={{flex: 1}}>
<WebView
ignoreSilentHardwareSwitch={true}
startInLoadingState={true}
domStorageEnabled={true}
style={{flex: 1, backgroundColor: 'red'}}
source={{uri: 'xxxx'}}/>
  </View>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
分享
微博
QQ
微信
回复
2024-12-25 20:07:08
相关问题
HarmonyOS webview H5页面事件监听
1381浏览 • 1回复 待解决
HarmonyOS react-native-webview闪退问题
947浏览 • 1回复 待解决
HarmonyOS 通过webview改变H5页面字体
937浏览 • 1回复 待解决
HarmonyOS h5页面缩放问题
2011浏览 • 1回复 待解决
HarmonyOS H5页面localstorage为null
944浏览 • 1回复 待解决
HarmonyOS H5页面加载缓存机制
1345浏览 • 1回复 待解决
HarmonyOS 原生和H5页面交互
753浏览 • 1回复 待解决