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 
      ] 
相關問題