Skip to content

Commit

Permalink
Revert "Add prop to force fullscreen preview for videos. (#20436)" (#…
Browse files Browse the repository at this point in the history
…21770)

This reverts commit e19b804.
  • Loading branch information
SergioEstevao committed Apr 22, 2020
1 parent 74fcd4c commit 3f65ca2
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/block-editor/src/components/video-player/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Video extends Component {
super( ...arguments );
this.isIOS = Platform.OS === 'ios';
this.state = {
isFullScreen: false,
videoContainerHeight: 0,
};
this.onPressPlay = this.onPressPlay.bind( this );
Expand Down Expand Up @@ -83,12 +84,8 @@ class Video extends Component {
}

render() {
const {
isSelected,
style,
forceFullscreen = ! this.isIOS,
} = this.props;
const { videoContainerHeight } = this.state;
const { isSelected, style } = this.props;
const { isFullScreen, videoContainerHeight } = this.state;
const showPlayButton = videoContainerHeight > 0;

return (
Expand All @@ -98,12 +95,21 @@ class Video extends Component {
ref={ ( ref ) => {
this.player = ref;
} }
pointerEvents={ isSelected ? undefined : 'none' }
controls={ ! forceFullscreen }
// Using built-in player controls is messing up the layout on iOS.
// So we are setting controls=false and adding a play button that
// will trigger presentFullscreenPlayer()
controls={ false }
ignoreSilentSwitch={ 'ignore' }
paused={ ! isFullScreen }
onLayout={ this.onVideoLayout }
onFullscreenPlayerWillPresent={ () => {
this.setState( { isFullScreen: true } );
} }
onFullscreenPlayerDidDismiss={ () => {
this.setState( { isFullScreen: false } );
} }
/>
{ showPlayButton && forceFullscreen && (
{ showPlayButton && (
// If we add the play icon as a subview to VideoPlayer then react-native-video decides to show control buttons
// even if we set controls={ false }, so we are adding our play button as a sibling overlay view.
<TouchableOpacity
Expand Down

0 comments on commit 3f65ca2

Please sign in to comment.