react-native-af-video-player icon indicating copy to clipboard operation
react-native-af-video-player copied to clipboard

Fullscreen doesn't expand fullscreen, but expands inside the container.

Open GSolari79 opened this issue 7 years ago • 15 comments

The component is called in here with Video props:
<CardItem> <View style={{ flex: 1 }}> <VideoPlayer video={{ name: 'video file', poster: 'poster', videoStyle: styles.backgroundVideo }} /> </View> </CardItem>

Styles: backgroundVideo: { position: 'relative', top: 0, left: 0, bottom: 0, right: 0, width: null, height: 200 }

The video player:

class VideoPlayer extends Component { render() { return ( <Video url={this.props.video.name} placeholder={this.props.video.poster} style={this.props.video.videoStyle} /> ); } }

export default VideoPlayer;

When I click the fullscreen button in controls, then I get the behaviour you see in the image.

  • [ ] react-native-af-video-player version: @0.1.7
  • [ ] React Native version:@0.53.3
  • [ ] OS: Both Android and iOS fullscreenclicked normal

Thanks in advance, really appreciated

GSolari79 avatar Mar 23 '18 11:03 GSolari79

Video Player:

      <Video
          url={this.props.video.name}
          placeholder={this.props.video.poster}
          style={this.props.video.videoStyle}
      />

GSolari79 avatar Mar 23 '18 11:03 GSolari79

Hello @GSolari79,

Based on the readme, does this solve your issue? https://github.com/abbasfreestyle/react-native-af-video-player#fullscreen-videos-inside-a-scrollview

abbasfreestyle avatar Mar 23 '18 12:03 abbasfreestyle

Hi @abbasfreestyle Thanks for your reply, this doesn't resolve the issue. It does the same thing just rotating the screen :(

GSolari79 avatar Mar 23 '18 12:03 GSolari79

Can you provide a video example?

What's your reason for adding position relative styling to the container?

abbasfreestyle avatar Mar 23 '18 13:03 abbasfreestyle

While testing stayed that way, with absolute position on Video I get this image. Expanding in the CardItem without leaving gaps. screen shot 2018-03-23 at 15 19 12

GSolari79 avatar Mar 23 '18 13:03 GSolari79

My video example is the following:

class VideoPlayer extends Component {

constructor() { super(); this.state = { fullScreen: false }; }

onFullScreen(fullScreen) { this.setState({ fullScreen }); }

render() {
  const { fullScreen } = this.state;
return (
  <View style={{ flex: 1 }} >
    <Video
      url={this.props.video.name}
      placeholder={this.props.video.poster}
      onFullScreen={status => this.onFullScreen(status)}
      fullScreen={fullScreen}
      style={this.props.video.videoStyle}
    />
  </View>
);

} }

export default VideoPlayer;

GSolari79 avatar Mar 23 '18 13:03 GSolari79

The issue is that the fullscreen control expands the video not to the whole screen but inside the CardItem that the Video is called from

GSolari79 avatar Mar 23 '18 13:03 GSolari79

The CardItem is from nativebase and it is wrapped inside Container, Content like this:

> <Card style={{ flex: 1 }}>
>               <CardItem>
>                 <Left>
>                   <Thumbnail square small source={{ uri: 'link' }} />
>                   <Body>
>                     <Text>Uni Messenger</Text>
>                     <Text note>Unisomnia Social Network</Text>
>                   </Body>
>                 </Left>
>               </CardItem>
>               <CardItem>
>                 <VideoPlayer
>                   video={{
>                       name: 'video Link',
>                       poster: 'poster Link',
>                       videoStyle: styles.backgroundVideo
>                   }}
>                 />
>               </CardItem>
>               <CardItem>
>                   <Text style={styles.textFormat}>
>                              Some Text.................
>                   </Text>
>               </CardItem>
>               <CardItem style={{ height: 'auto', alignSelf: 'center' }}>
>                 <Icon
>                   raised
>                   type="entypo"
>                   name='google-play'
>                   size={25}
>                   color={'#8ac53f'}
>                   onPress={() => Linking.openURL('link')}
>                 />
>                 <Icon
>                   raised
>                   type="font-awesome"
>                   name='photo'
>                   size={25}
>                   color={'#8ac53f'}
>                   onPress={() => this.goToUnisomniaAlbum()}
>                 />
>               </CardItem>
>             </Card>
>         </Content>
>       </Container>

GSolari79 avatar Mar 23 '18 13:03 GSolari79

So Based on the readme you should be able to achieve the following: https://github.com/abbasfreestyle/react-native-af-video-player#fullscreen-videos-inside-a-scrollview

<Card style={{ flex: 1 }}>
  <CardItem style={fullScreen ? null : styles.backgroundVideo}>
    <Video
      url={somelink}
      placeholder={someplaceholder}
      onFullScreen={fullScreen => this.setState({ fullScreen }) }
      contentAbove={
        <CardItem>
          <Left>
            <Thumbnail square small source={{ uri: 'link' }} />
            <Body>
              <Text>Uni Messenger</Text>
              <Text note>Unisomnia Social Network</Text>
            </Body>
          </Left>
        </CardItem>
      }
      contentBelow={
      <View>
        <CardItem>
          <Text style={styles.textFormat}>
            Some Text.................
          </Text>
        </CardItem>
        <CardItem style={{ height: 'auto', alignSelf: 'center' }}>
          <Icon
            raised
            type="entypo"
            name='google-play'
            size={25}
            color={'#8ac53f'}
            onPress={() => Linking.openURL('link')}
          />
          <Icon
            raised
            type="font-awesome"
            name='photo'
            size={25}
            color={'#8ac53f'}
            onPress={() => this.goToUnisomniaAlbum()}
          />
        </CardItem>
      </View>
      }
    />
  </CardItem>
</Card>

I dont really have time to test this, but in theory it should work or close to working.

You'll probably need to fork and make amendments to the VideoScrollHandler if you dont want to have the styles affect the ScrollView

abbasfreestyle avatar Mar 23 '18 16:03 abbasfreestyle

I have already tested many things regarding the styles in order to make it function. It has to do with custom styling of NativeBase. The only way to make it work is call a modal and play the video in there, avoiding this ways the code with Container ... etc. Now I am facing an issue where rotateToFullScreen doesn't work for Android...

GSolari79 avatar Mar 23 '18 16:03 GSolari79

I had resolve the problem by add rotateToFullScreen={true}

I find those code in VideoPlayer.js:

this.setState({ fullScreen: true }, () => {
    this.props.onFullScreen(this.state.fullScreen)
    if (this.props.rotateToFullScreen) Orientation.lockToLandscape()
})

santa955 avatar Mar 27 '18 16:03 santa955

I've made some updates in version 0.1.8 to better support container styling with a ScrollView. I've updated the readme :)

abbasfreestyle avatar Apr 01 '18 03:04 abbasfreestyle

I'm looking for a replacement for my actual video controller, but I have the same configuration as @GSolari79 . I'm using a flatlist, and each item is a component which has the video component inside multiple containers. Is there any solution to this?

hoscarcito avatar Apr 06 '18 05:04 hoscarcito

Not at the moment @hoscarcito. Ultimately the best case scenario would be to strip away from the custom ScrollView. At the moment it's proven difficult to do so because Components are limited and unaware of their Container Components.

If there's an alternative approach to solve this issue i'm open to suggestions.

abbasfreestyle avatar May 29 '18 23:05 abbasfreestyle

can we change this portrait view to landscape mode in the beginning? your help is highly appreciated screen shot 2018-08-20 at 9 55 25 am screen shot 2018-08-20 at 9 55 40 am

ThisaraGitHub avatar Aug 20 '18 04:08 ThisaraGitHub