Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wrong orientation on Android #842

Closed
wants to merge 2 commits into from

Conversation

timhonders
Copy link

Android uses rotationDegrees to tell the orientation of the video.

The width and height are always landscape mode even if a video is portrait.

Fix:
To determine the orientation i check rotation Degrees.
IOS always has rotation = 0, so when it is 0 fallback to the old method.

@sunweiyang
Copy link

@mattapperson, can this fix be merged?

@mattapperson
Copy link
Contributor

@sunweiyang actually @isaiahgrey93 is the maintainer now for this project

@sunweiyang
Copy link

Thanks @mattapperson!
@isaiahgrey93, this pull request is helpful for vertical videos.

@cobarx
Copy link
Contributor

cobarx commented Jun 9, 2018

Any chance you can provide a video that doesn't work. I've tested:
http://www.exit109.com/~dnn/clips/RW20seconds_1.mp4
and it's working properly on an API 26 emulator.

We recently updated from ExoPlayer 2.4.0 to 2.7.3 and before merging a fix, I want to make sure there's still a problem. Plus I need to test to make sure the fix works :)

@cobarx
Copy link
Contributor

cobarx commented Jun 10, 2018

Per comment from @sunweiyang in #948, this is now working since we've updated ExoPlayer. Going to close this, please reopen and include a broken video example if you're still having issues.

@cobarx cobarx closed this Jun 10, 2018
@mbret
Copy link

mbret commented Jun 14, 2018

Do you have any idea when the bugfix will be released ? The last version is 2.2.0 and the bug is still present (even with exoplayer)

@cobarx
Copy link
Contributor

cobarx commented Jun 20, 2018

@mbret Can you provide me with a video where this happens? Also need info about what device to test with.

@mousikosk
Copy link

mousikosk commented Jun 20, 2018

@cobarx Genymotion: Samsung Galaxy S8 - 8.0 - API 26 - 1440x2960 Video file (recorded with iPhone SE): https://www.dropbox.com/s/zvp352nax4q8m91/32722631-d166-45bf-810e-b79490b46c78.mp4?dl=1 <Video source={{ uri: sourceURI }} onEnd={this.onPlaybackEnd} ignoreSilentSwitch="ignore" resizeMode="cover" />

@mbret
Copy link

mbret commented Jun 20, 2018

@cobarx Any video recorded with your android simulator. I also tried a lot of different OS images. I will send you a link to a video as soon as I'm home

@cobarx
Copy link
Contributor

cobarx commented Jun 20, 2018

@mousikosk Thanks for providing the video. I'm definitely seeing the issue now.

@mbret @timhonders
I'm still understanding how this is supposed to get handled. Once you have the right dimensions and orientation, how do you rotate the video to the right orientation? In fullscreen, you can lock the orientation but what about if the video isn't fullscreen? I'm wondering whether we can handle the rotation automatically in ExoPlayer rather than forcing the developer to get the info from onLoad and then apply some sort of transformation.

I also want to make sure we report the correct width & height. Since this is pretty complicated behavior, it's critical to get it fully documented.

@cobarx
Copy link
Contributor

cobarx commented Sep 22, 2018

Can anyone provide info on how we fix the problem once we have the orientation returned by this code?

@ozankonur
Copy link

Still an issue for android 4.0...

@ozankonur
Copy link

I found a way that no need to changed 2 files, I just changed code on ReactExoplayerView.java;
int width = videoFormat != null ? videoFormat.width : 0;
int height = videoFormat != null ? videoFormat.height : 0;

to;

        `int width = videoFormat != null ? ((videoFormat.rotationDegrees==0 || videoFormat.rotationDegrees==180) ? videoFormat.width : videoFormat.height) : 0;`
        `int height = videoFormat != null ? ((videoFormat.rotationDegrees==0 || videoFormat.rotationDegrees==180) ? videoFormat.height : videoFormat.width) : 0;`

BUT somehow, it is overwriting by something and it is rendered wrong again...

@josesuero
Copy link

Hi, is there any news or workarounds on this, all my react-native-camera videos on android appear sideways, I have ready to launch stopped only by this, could someone please help me, since i'm using videos recored by the same app any workaround even on video format would be appreciated

@tjann
Copy link

tjann commented Jul 1, 2019

I have a vertical (portrait) video that is being rotated by the video player. Such that when the phone is vertical, the "player" takes up the whole vertical screen, but the video is sideways. If this PR can fix this, that would be great. If anyone has a workaround please lmk as well. Thanks!

@SiyabongaNzulwana
Copy link

Hi guys, @josesuero Has any of you found a solution to this video being rotated on some versions of Android??? I need help here.

@Rotemy
Copy link

Rotemy commented Jul 19, 2020

Happens to me on 4.4.5 with MOV file

@aareusoftnet
Copy link

Please merge this PRs it's very critical bug.

@stale
Copy link

stale bot commented Apr 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are having a similar problem, please open a new issue and reference this one instead of commenting on a stale or closed issue.

@stale stale bot added the stale Closed due to inactivity or lack or resources label Apr 19, 2022
@hueniverse
Copy link
Contributor

hueniverse commented Apr 20, 2022

@timhonders I know it's crazy to review a 5 years old PR but can this be updated to master? Closing for now but will reopen if you have the time to update.

@hueniverse hueniverse removed the stale Closed due to inactivity or lack or resources label Apr 20, 2022
@hueniverse hueniverse closed this Apr 22, 2022
@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet