TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://thewidlarzgroup.github.io/react-native-video/
MIT License
7.19k stars 2.9k forks source link

[both]wrong NaturalSize and [android]fullscreen orientation #1530

Closed EJohnF closed 2 years ago

EJohnF commented 5 years ago

Current behavior

onLoad returns wrong naturalSize

Reproduction steps

strait usage of component

<Video
                    ref={(ref) => {
                      this.player = ref;
                    }}
                    onLoad={(e) => { this.player.seek(0); this.onLoad(e); }}
                    onError={bugsnagNotify}
                    paused
                    source={{ uri: currentMessage.url }}
                    resizeMode="cover"
                    style={{
                      width: imageWidth,
                      height: this.state.ratio * imageWidth
                    }} />

in onLoad function, put console. Results (NaturalSize && url): { orientation: 'landscape', height: 720, width: 1280 }, 'http://tiney-chat-attachment-qa.s3-website.eu-west-2.amazonaws.com/e974448c-215e-49a6-8238-e7d1d3d543f1.mp4'

it (or maybe it's another unrelated problem?) - wrong orientation in fullscreen https://yadi.sk/d/-rJ78MH45qt33A

Expected behavior

should be portrait orientation with swiped height/width

Platform

Which player are you experiencing the problem on:

Video sample

EJohnF commented 5 years ago

I tried another version - react-native-video 2.2.0 (with MediaPlayer on Adnroid) and naturalSize become correct { orientation: 'portrait', height: 1280, width: 720 }, 'http://tiney-chat-attachment-qa.s3-website.eu-west-2.amazonaws.com/e974448c-215e-49a6-8238-e7d1d3d543f1.mp4'

nikonhub commented 5 years ago

Hello,

I think the problem is kind of related to this one

I also have this problem with the player which shows a portrait video with a wrong orientation.

image

The onLoad event returns width : 1280 height : 720 orientation : landscape

Because it only compares width > height.

I adapted the code from the PR above to return the right orientation so I can at least set the right size for the container. But it seems the true problem for the wrong orientation comes from somewhere else.

Ashoat commented 4 years ago

This package's ExoPlayer implementation sources the naturalSize from the React container dimensions, whereas the MediaPlayer implementation actually pulls from the video. Somebody could submit a PR to the ExoPlayer side to address this. Some helpful guidance here

Mussabaheen commented 3 years ago

Any Solution?