Closed bcalik closed 8 years ago
The dimensions are posted in onLoad
event body.
@sjchmiela Thanks! I did not notice that. It should be documented in readme.
@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
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.
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? 🙏
Dimensions return wrong values if the video is in landscape orientation. Please check this pull request, I appended the orientation information: https://github.com/brentvatne/react-native-video/pull/205
I don't develop on Android, sorry… 😞
I'll leave it open until Android side is implemented.
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.
Android version is ready. PR https://github.com/brentvatne/react-native-video/pull/239
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.