【发布时间】:2017-08-24 15:59:00
【问题描述】:
我的应用上有一个使用 create-react-native-app 构建的视频,我正在使用 expo.io 的 Video 组件。我正在显示本地视频,并且在我的应用程序上,当连接到互联网时它可以工作,但是当应用程序离线时,视频无法播放/工作/加载。
这是我的项目结构:
App.js app.json node_modules yarn.lock
App.test.js images package.json
README.md my-app-key.keystore videos
这是视频播放器组件的代码:
import React, { Component } from 'react';
import { StyleSheet, Text, View, Image, Button } from 'react-native';
import { Video } from 'expo';
class Player extends Component {
constructor(props){
super(props);
}
render(){
return(
<Video
source={require('./videos/asthma-1.mp4')} //local video
rate={1.0}
volume={1.0}
muted={false}
useNativeControls
resizeMode="cover"
shouldPlay
isLooping
style={{ width: 900, height: 450, position:'relative',left:350,bottom:410 }} />
)
}
}
我做错了什么?为什么视频是在线交付而不是离线交付?
顺便说一句,我在安卓设备上使用它
编辑:另外,我注意到位于图像文件夹中的图像可以离线和在线工作。我是否错误地构建/命名了我的视频文件夹以使其无法离线加载?
【问题讨论】:
标签: react-native