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

解决方案

尝试加上ignoreSilentHardwareSwitch={true}。

<View style={{flex: 1}}>
<WebView
ignoreSilentHardwareSwitch={true}
startInLoadingState={true}
domStorageEnabled={true}
style={{flex: 1, backgroundColor: 'red'}}
source={{uri: 'xxxx'}}/>
  </View>
分享
微博
QQ
微信
回复
2024-12-25 20:07:08
相关问题
HarmonyOS webview H5页面事件监听
459浏览 • 1回复 待解决
HarmonyOS react-native-webview闪退问题
305浏览 • 1回复 待解决
HarmonyOS 通过webview改变H5页面字体
329浏览 • 1回复 待解决
HarmonyOS h5页面缩放问题
972浏览 • 1回复 待解决
HarmonyOS H5页面localstorage为null
348浏览 • 1回复 待解决