gpt4 book ai didi

react-native - 如何在没有 webview 的情况下将 vimeo 播放器嵌入 react-native?

转载 作者:行者123 更新时间:2023-12-05 05:09:48 24 4
gpt4 key购买 nike

我的 react-native 应用程序需要一个 vimeo 播放器,但它不能是 WebView。有一些应用具有这种行为,但我找不到它的库。

const html = `<iframe ... src="https://player.vimeo.com/video/${video.id}"></iframe>` 
<WebView ... source={{ html }} />

这个片段是我当前的播放器,但它并没有提供良好的 webview 用户体验。

最佳答案

您可以使用这个模块。 React Native Vimeo 播放器

你可以运行 npm install react-native-vimeo

用法

<Vimeo
ref='video'
videoId='2619976' // Vimeo video ID
onReady={ () => console.log('Video is ready') }
onPlay={ () => console.log('Video is playing') }
onPlayProgress={ data => console.log('Video progress data:', data) }
onFinish={ () => console.log('Video is finished') }
/>

关于react-native - 如何在没有 webview 的情况下将 vimeo 播放器嵌入 react-native?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57228786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com