I
I
Iskandar Dvurogov2017-01-27 12:41:06
Android
Iskandar Dvurogov, 2017-01-27 12:41:06

How to resize videos in react-native-video-player?

Hey! I'm using react-native-video-player and I've run into a problem where in landscape orientation the video goes out of view and also pushes the navigation controls down.
ac0cde37d27d4b7e8d734ecace404d32.png
I am using the following code:

import React, { Component } from 'react';
import { View, Text } from 'react-native';
import VideoPlayer from 'react-native-video-player';

export default class VideoPage extends Component {

  render() {
   return (
    <View>
      <VideoPlayer
        video={{ uri: 'file:///storage/emulated/0/Download/sample_video.mp4' }}
        videoWidth={1280}
        videoHeight={720}
      />
    </View>
   );
  }
}

Changing the videoWidth or videoHeight parameters does nothing.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Iskandar Dvurogov, 2017-01-27
@1nussebedernipes

You can do it, but you need to solve the problem with changing the orientation from landscape to portrait

import React, { Component } from 'react';
import { View, Text } from 'react-native';
import VideoPlayer from 'react-native-video-player';

export default class VideoPage extends Component {

  render() {
    return (
      <View style={{height: 650, width: 1300, paddingLeft: 155}}>
        <VideoPlayer
          video={{ uri: 'file:///storage/emulated/0/Download/sample_video.mp4' }}
        />
      </View>
    );
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question