在react-native-video播放器中播放React Native Webview视频

时间:2020-09-08 16:00:08

标签: reactjs react-native react-native-webview react-native-video

如何仅使用react-native-video播放视频?我可以从react-native-webview获取视频URL。但是,当我单击webview内的媒体URL时,它同时使用react-native-video和react-native-webview默认播放器进行播放。如何防止使用react-native-webview默认播放器?

我的webview代码是:

<WebView
    userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
    onLoadStart={() => this.onPageLoadStart()}
    onLoadEnd={() => this.onPageLoadEnd()}
    onError={() => this.handleNetworkError()}
    onMessage={this.onWebViewMessage}
    source={{ 
        uri: this.state.url
    }}
    ref={(webView) => this.webView.ref = webView}
    style={{ height: this.state.scrollViewHeight, width: this.state.scrollViewWidth }}
    onNavigationStateChange={this.navigationStateChangedHandler.bind(this)}
    javaScriptEnabled={true}
    sharedCookiesEnabled={true}
    domStorageEnabled={true}
    thirdPartyCookiesEnabled={true}
    mediaPlaybackRequiresUserAction={true} />

谢谢。

0 个答案:

没有答案