我試圖用react-native-video插件顯示視頻。在設備上進行測試時,視頻正在工作,但在iOS模擬器上顯示黑屏(模擬器上的測試對我來說更快,更容易)。有人有同樣的問題。這裏是我的代碼:在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}
/>