通过 ImagePicker 选择的视频使用 react-native-video 不可见
video selected through ImagePicker not visible using react-native-video
我正在使用 react-native-ImagePicker 和 react-native-video 包。
我使用 ImagePicker 选择了一个视频,效果非常好。
现在我想要的是显示我正在使用的所选视频
react-native-video 如下
`<Video source={source}
ref={(ref) => {
this.player = ref
}}
rate={1.0} // 0 is paused, 1 is normal.
volume={1.0} // 0 is muted, 1 is normal.
muted={false} // Mutes the audio entirely.
paused={false} // Pauses playback entirely.
resizeMode="cover" // Fill the whole screen at aspect ratio.*
repeat={true} // Repeat forever.
playInBackground={false} // Audio continues to play when app entering background.
playWhenInactive={false} // [iOS] Video continues to play when control or notification center are shown.
ignoreSilentSwitch={"ignore"} // [iOS] ignore | obey - When 'ignore', audio will still play with the iOS hard silent switch set to silent. When 'obey', audio will toggle with the switch. When not specified, will inherit audio settings as usual.
progressUpdateInterval={250.0} // [iOS] Interval to fire onProgress (default to ~250ms)
onLoadStart={this.loadStart} // Callback when video starts to load
onLoad={this.setDuration} // Callback when video loads
onProgress={this.setTime} // Callback every ~250ms with currentTime
onEnd={this.onEnd} // Callback when playback finishes
onError={this.videoError} // Callback when video cannot be loaded
onBuffer={this.onBuffer} // Callback when remote video is buffering
onTimedMetadata={this.onTimedMetadata}/>`
来源是
`source = videoUrl.split("file://")[1]`
我成功了。
<Video>
缺少样式。一旦我设置它,它工作得很好。
更重要的是有时会出现错误 "cannot read constant of undefined" 这是因为视频库链接不正确。在xCode中删除并再次添加,错误将变为
我正在使用 react-native-ImagePicker 和 react-native-video 包。 我使用 ImagePicker 选择了一个视频,效果非常好。
现在我想要的是显示我正在使用的所选视频 react-native-video 如下
`<Video source={source}
ref={(ref) => {
this.player = ref
}}
rate={1.0} // 0 is paused, 1 is normal.
volume={1.0} // 0 is muted, 1 is normal.
muted={false} // Mutes the audio entirely.
paused={false} // Pauses playback entirely.
resizeMode="cover" // Fill the whole screen at aspect ratio.*
repeat={true} // Repeat forever.
playInBackground={false} // Audio continues to play when app entering background.
playWhenInactive={false} // [iOS] Video continues to play when control or notification center are shown.
ignoreSilentSwitch={"ignore"} // [iOS] ignore | obey - When 'ignore', audio will still play with the iOS hard silent switch set to silent. When 'obey', audio will toggle with the switch. When not specified, will inherit audio settings as usual.
progressUpdateInterval={250.0} // [iOS] Interval to fire onProgress (default to ~250ms)
onLoadStart={this.loadStart} // Callback when video starts to load
onLoad={this.setDuration} // Callback when video loads
onProgress={this.setTime} // Callback every ~250ms with currentTime
onEnd={this.onEnd} // Callback when playback finishes
onError={this.videoError} // Callback when video cannot be loaded
onBuffer={this.onBuffer} // Callback when remote video is buffering
onTimedMetadata={this.onTimedMetadata}/>`
来源是
`source = videoUrl.split("file://")[1]`
我成功了。
<Video>
缺少样式。一旦我设置它,它工作得很好。
更重要的是有时会出现错误 "cannot read constant of undefined" 这是因为视频库链接不正确。在xCode中删除并再次添加,错误将变为