2

video.jsファイルにナビゲートするいくつかのアプリケーションを操作して、ビデオが自動的に横長の向きでフルスクリーンで再生されるようにしたい。私が反応し、ネイティブビデオ リンクを使用していビデオを横長フルスクリーンの方向にロックする(反応 - ネイティブビデオ)

https://github.com/react-native-community/react-native-video

render() { 
 

 
    return (
 
     <View style={styles.container}> 
 
     <View style={styles.fullScreen}> 
 
      <Video 
 
      ref={(ref) => { 
 
       this.player = ref 
 
      }} 
 
      source={require('../vid/intro-video.mp4')} 
 
      style={styles.nativeVideoControls} 
 
      rate={this.state.rate} 
 
      paused={this.state.paused} 
 
      volume={this.state.volume} 
 
      muted={this.state.muted} 
 
      resizeMode={this.state.resizeMode} 
 
      onLoad={this.onLoad} 
 
      onLoadStart={this.loadStart} 
 
      onBuffer={this.onBuffer} 
 
      onProgress={this.onProgress} 
 
      onEnd={debounce(this.onEnd, 100)} 
 
      repeat={false} 
 
      controls={this.state.controls} 
 
      /> 
 
     </View> 
 
     </View> 
 
    ); 
 
    }

私が回転したときに、私はloadStart関数の中、このベロコードを追加しようとするが、それは働いていない...とフルスクリーンモードではない場合、ビデオは私の画面の一番下に表示されます。

this.player.presentFullscreenPlayer()

enter image description here

私が試した解決策: 1)タグが、何が起こったのビューにonLayout使用。 2)this.player.presentFullscreenPlayer()を使用しても問題は解決されませんでした。

答えて

0

この問題の解決策はまだ見つかりませんでしたが、一時的な回避策を共有したいだけです。

私はcomponentWillMount内)(ネイティブ・オリエンテーションを反応させ、lockToLandscapeを誘発する別のパッケージを使用していますし、私は次元

Orientation.lockToLandscape(); 
 
height = Dimensions.get('window').height; 
 
width = Dimensions.get('window').width;

を使用して、デバイスの幅と高さを取得し、 onLoadメソッド内にpresentFullScreenPlayerを追加します。

this.player.presentFullscreenPlayer();

と私は幅を設定し、幅と高さを使用してビデオプレーヤーの高さは、デバイスの寸法から取得すること...

あなたたちは別の方法を持っている場合は、共有を行う:) ありがとうございました

関連する問題