0

我正在使用模块react-native-video,它在调试版本中以我希望的方式工作。但只要我assembleRelease它只显示一个白色的屏幕,而不是视频。为什么它没有在发布版本中播放?视频在调试版本中的工作,但在发布版本中他们不显示

我认为,不知何故,当它编译它不能找到位置了,但我会如何解决?

这是我的视频组件:

render() { 
    let video = this.props.video; 

    return (
     <TouchableHighlight onPress={this.backToQuestion}> 
      <View> 
      <Video source={video} // 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="stretch"    // 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 
        onProgress={() => {this.state.restart ? this.restartVideo() : null}}  // Callback every ~250ms with currentTime 
        onEnd={this.backToQuestion}    // Callback when playback finishes 
        onError={this.videoError}  // Callback when video cannot be loaded 
        style={styles.video} /> 
      </View> 
     </TouchableHighlight> 
    ) 

视频的道具是从另一个页面传递这样的:

let videos = [ 
    require('../videos/HISTORISCHETUIN.mp4'), //0n 
    require('../videos/HISTORISCHETUIN.mp4'), //1n 
    require('../videos/HISTORISCHETUIN.mp4'), //2n 
    require('../videos/TOREN.mp4'), //3 
    require('../videos/KELDER.mp4'), //4 
    require('../videos/HISTORISCHETUIN.mp4'), //5 
    require('../videos/SLOTGRACHT.mp4'), //6 
    require('../videos/PLEIN.mp4') //7 
] 

goToVideo =() => { 
    this.props.music.backgroundMusic.pause() 
    Actions.videoplayer({paused: false, restart: true, video: videos[question.image]}) 
} 

回答

1

把影片中res/raw/,并采取了资金解决我的问题!

这是我的新阵列的外观

let videos = [ 
      {uri: 'historischetuin'}, //0n 
      {uri: 'historischetuin'}, //1n 
      {uri: 'historischetuin'}, //2n 
      {uri: 'toren'}, //3 
      {uri: 'kelder'}, //4 
      {uri: 'historischetuin'}, //5 
      {uri: 'slotgracht'}, //6 
      {uri: 'plein'} //7 
      ] 
相关问题