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]})
}
4

1 回答 1

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
          ]
于 2016-12-05T15:58:56.303 回答