better media aspect ratio handling
This commit is contained in:
parent
a094ba7d5c
commit
066919259c
2 changed files with 7 additions and 6 deletions
|
@ -32,7 +32,7 @@ class MediaPlayer extends React.PureComponent {
|
||||||
rate: 1,
|
rate: 1,
|
||||||
volume: 1,
|
volume: 1,
|
||||||
muted: false,
|
muted: false,
|
||||||
resizeMode: 'stretch',
|
resizeMode: 'contain',
|
||||||
duration: 0.0,
|
duration: 0.0,
|
||||||
currentTime: 0.0,
|
currentTime: 0.0,
|
||||||
paused: !props.autoPlay,
|
paused: !props.autoPlay,
|
||||||
|
@ -131,7 +131,6 @@ class MediaPlayer extends React.PureComponent {
|
||||||
this.showPlayerControls();
|
this.showPlayerControls();
|
||||||
const { onFullscreenToggled } = this.props;
|
const { onFullscreenToggled } = this.props;
|
||||||
this.setState({ fullscreenMode: !this.state.fullscreenMode }, () => {
|
this.setState({ fullscreenMode: !this.state.fullscreenMode }, () => {
|
||||||
this.setState({ resizeMode: this.state.fullscreenMode ? 'contain' : 'stretch' });
|
|
||||||
if (onFullscreenToggled) {
|
if (onFullscreenToggled) {
|
||||||
onFullscreenToggled(this.state.fullscreenMode);
|
onFullscreenToggled(this.state.fullscreenMode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ import Colors from './colors';
|
||||||
|
|
||||||
const screenDimension = Dimensions.get('window');
|
const screenDimension = Dimensions.get('window');
|
||||||
const screenWidth = screenDimension.width;
|
const screenWidth = screenDimension.width;
|
||||||
|
const containedMediaHeight = ((screenWidth * 9) / 16); // 16:9 display ratio
|
||||||
|
const containedMediaHeightWithControls = containedMediaHeight + 17;
|
||||||
|
|
||||||
const filePageStyle = StyleSheet.create({
|
const filePageStyle = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -30,7 +32,7 @@ const filePageStyle = StyleSheet.create({
|
||||||
mediaContainer: {
|
mediaContainer: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
height: 240
|
height: containedMediaHeightWithControls
|
||||||
},
|
},
|
||||||
emptyClaimText: {
|
emptyClaimText: {
|
||||||
fontFamily: 'Metropolis-Regular',
|
fontFamily: 'Metropolis-Regular',
|
||||||
|
@ -75,7 +77,7 @@ const filePageStyle = StyleSheet.create({
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
width: screenWidth,
|
width: screenWidth,
|
||||||
height: 224,
|
height: containedMediaHeight,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center'
|
alignItems: 'center'
|
||||||
},
|
},
|
||||||
|
@ -92,7 +94,7 @@ const filePageStyle = StyleSheet.create({
|
||||||
},
|
},
|
||||||
containedPlayer: {
|
containedPlayer: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 240,
|
height: containedMediaHeightWithControls,
|
||||||
},
|
},
|
||||||
containedPlayerLandscape: {
|
containedPlayerLandscape: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
@ -114,7 +116,7 @@ const filePageStyle = StyleSheet.create({
|
||||||
},
|
},
|
||||||
containedPlayerBackground: {
|
containedPlayerBackground: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 206,
|
height: containedMediaHeight,
|
||||||
},
|
},
|
||||||
fullscreenPlayerBackground: {
|
fullscreenPlayerBackground: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
|
Loading…
Reference in a new issue