如何将视频海报适合视频播放器高度在Expo React本地视频播放器中
我正在使用 https://github.com/github.com/ihmpavel/expo/expo-video-player 此库在React Native应用中添加视频播放器并将海报图像设置为视频播放器。如下所示:
<VideoPlayer
videoProps={{
resizeMode: Video.RESIZE_MODE_CONTAIN,
source: {
uri: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
},
usePoster: true,
posterSource: {
uri: props.thumbnail,
},
posterStyle: {
width: FULL_WIDTH - 35,
height: FULL_WIDTH - 35,
},
}}
style={{
width: FULL_WIDTH - 35,
height: FULL_WIDTH - 35,
}}
defaultControlsVisible
/>
显示如下:
海报 ?
I'm using https://github.com/ihmpavel/expo-video-player this library to add video player in react native app and setting poster image to video player. as shown below:
<VideoPlayer
videoProps={{
resizeMode: Video.RESIZE_MODE_CONTAIN,
source: {
uri: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
},
usePoster: true,
posterSource: {
uri: props.thumbnail,
},
posterStyle: {
width: FULL_WIDTH - 35,
height: FULL_WIDTH - 35,
},
}}
style={{
width: FULL_WIDTH - 35,
height: FULL_WIDTH - 35,
}}
defaultControlsVisible
/>
poster is displayed as below:
How to fit poster image in video player exactly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需这样做:
Simply do this:
博览会视频不支持
recizemode
postersource
,因此您可以在加载视频时显示覆盖层。Expo video doesn't support
resizeMode
forposterSource
so you can show an overlay while video is being loaded.