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

[Android] Getting the video dimensions #203

Closed
bcalik opened this issue Apr 30, 2016 · 9 comments
Closed

[Android] Getting the video dimensions #203

bcalik opened this issue Apr 30, 2016 · 9 comments
Labels
feature help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it.

Comments

@bcalik
Copy link
Contributor

bcalik commented Apr 30, 2016

Is it possible to get actual video dimensions (width and height)?

I am trying to make a video cropper UI. So I need the actual dimensions of video, then wrap it to a View with overflow hidden, then move the video inside using PanResponder.

Thank you.

@sjchmiela
Copy link
Contributor

The dimensions are posted in onLoad event body.

@bcalik
Copy link
Contributor Author

bcalik commented Apr 30, 2016

@sjchmiela Thanks! I did not notice that. It should be documented in readme.

@bcalik bcalik closed this as completed Apr 30, 2016
@bcalik
Copy link
Contributor Author

bcalik commented Apr 30, 2016

@sjchmiela Ok I couldn't get it :/

That's all I get:

canPlayFastForward: true
canPlayReverse: true
canPlaySlowForward: true
canPlaySlowReverse: true
canStepBackward: true
canStepForward: true
currentTime: 0
duration: 15
target: 870

@bcalik bcalik reopened this Apr 30, 2016
@sjchmiela
Copy link
Contributor

You're right, the changes and callbacks haven't been published to the npm yet. You've got to either point your package.json dependency to eg. master branch of this repo, or to wait for the new version to be pushed to npm, or to fork this repo and point the dependency to it.

@bcalik
Copy link
Contributor Author

bcalik commented Apr 30, 2016

Here is my package.json content:

"react-native-video": "git://github.com/brentvatne/react-native-video#master",

I see the following code in my node_modules/react-native-video/RCTVideo.m file on line 287:

@"naturalSize": @{
  @"width": width,
  @"height": height
},

I restarted the packager, and reloaded the app.
But interestingly I still don't get the result back.

@sjchmiela Do you have any idea?

Edit:
Ok I finally get it working, I forget to recompile.
Thank you very much.

@sjchmiela Will this be implemented for Android in soon? 🙏

@bcalik
Copy link
Contributor Author

bcalik commented May 1, 2016

Dimensions return wrong values if the video is in landscape orientation.
Please check this pull request, I appended the orientation information:
#205

@sjchmiela
Copy link
Contributor

I don't develop on Android, sorry… 😞

I'll leave it open until Android side is implemented.

@sjchmiela sjchmiela added feature help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it. labels May 1, 2016
@bcalik bcalik changed the title Getting the video dimensions [Android] Getting the video dimensions May 1, 2016
@bcalik
Copy link
Contributor Author

bcalik commented May 1, 2016

I don't develop too. But it is as simple as this:

mp.getVideoWidth();
mp.getVideoHeight();

Should be used right here:
https://github.com/brentvatne/react-native-video/blob/master/android/src/main/java/com/brentvatne/react/ReactVideoView.java#L225

I will try that and make a pull request some day in next weeks.

@bcalik
Copy link
Contributor Author

bcalik commented Jun 4, 2016

Android version is ready. PR #239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted The issue has been reviewed and is valid, and is waiting for someone to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants