Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 在iOS模拟器上测试时显示视频的黑屏_React Native - Fatal编程技术网

React native 在iOS模拟器上测试时显示视频的黑屏

React native 在iOS模拟器上测试时显示视频的黑屏,react-native,React Native,我正在尝试使用插件显示视频。在设备上测试时,视频正常工作,但在iOS模拟器上显示的是黑屏(在模拟器上测试对我来说更快、更容易)。有同样问题的人。这是我的密码: <Video source={{ uri: 'url' }} // Can be a URL or a local file. ref={(ref) => { this.player = ref; }}

我正在尝试使用插件显示视频。在设备上测试时,视频正常工作,但在iOS模拟器上显示的是黑屏(在模拟器上测试对我来说更快、更容易)。有同样问题的人。这是我的密码:

                  <Video
                    source={{ uri: 'url' }}   // Can be a URL or a local file.
                    ref={(ref) => { this.player = ref; }}                             // Store reference
                    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={this.state.paused}                 // Pauses playback entirely.
                    resizeMode="cover"             // Fill the whole screen at aspect ratio.
                    repeat={false}                // 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.
                    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
                    style={styles.backgroundVideo}
                />
{this.player=ref;}}//存储引用
速率={1.0}//0暂停,1正常。
卷={1.0}//0为静音,1为正常。
静音={false}//完全静音音频。
暂停={this.state.paused}//完全暂停播放。
resizeMode=“cover”//以纵横比填充整个屏幕。
repeat={false}//永远重复。
playInBackground={false}//当应用程序进入后台时,音频将继续播放。
playWhenInactive={false}/[iOS]视频在显示控制或通知中心时继续播放。
progressUpdateInterval={250.0}/[iOS]在Progress上触发的间隔(默认为~250ms)
onLoadStart={this.loadStart}//视频开始加载时的回调
onLoad={this.setDuration}//视频加载时的回调
onProgress={this.setTime}//使用currentTime每隔250ms进行一次回调
onEnd={this.onEnd}//播放结束时回调
OneError={this.videoError}//无法加载视频时回调
onBuffer={this.onBuffer}//远程视频缓冲时的回调
style={style.backgroundVideo}
/>
模拟器旨在帮助您设计、快速原型制作和测试您的应用程序,但它不应作为您的唯一测试平台。一个原因是模拟器中并非所有应用都可用。例如,摄像头应用程序仅在硬件设备上可用,不能在模拟器中复制

模拟器不会使用你电脑的摄像头,所以任何时候你使用摄像头做任何事情,它都会默认为一个黑屏


更多信息:

您的代码很好,但无法在任何模拟器中播放视频,您需要在真实设备上运行应用程序,无论是android还是ios