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

incorrect documentation for methods getSupportedPreviewSize / getSupportedPictureSize #199

Closed
anneb opened this issue Mar 5, 2017 · 3 comments

Comments

@anneb
Copy link
Contributor

anneb commented Mar 5, 2017

The current documentation in README.md for method getSupportedPreviewSize reads:

getSupportedPreviewSize(cb, [errorCallback])
 CameraPreview.getSupportedPreviewSize(function(dimensions){
   console.log('Width: ' + dimensions.width); 
   console.log('Height: ' + dimensions.height); 
});

However, on Android, the callback passes an array of dimensions. On iOS the callback always passes string 'universal'.

To describe this behaviour, the documentation should be something like:

getSupportedPreviewSize(cb, [errorCallback])
CameraPreview.getSupportedPreviewSize(function(dimensions) {
   if (typeof dimensions === 'string') {
     // string 'universal' : all dimensions allowed. 
     // If you need the content of the preview to exactly match the content of the picture,
     // then choose a preview aspect ratio (width / height) that matches the aspect ratio of
     // one of the supported picture sizes 
     console.log(dimensions);
   } else {
     // note that the portrait version, width and height swapped, of these dimensions are also supported
     dimensions.forEach(function(dimension){
       console.log(dimension.width + 'x' + dimension.height);
     });
  }
});

The documentation for getSupportedPictureSize reads:

CameraPreview.getSupportedPictureSize(function(dimensions){
  console.log('Width: ' + dimensions.width); 
  console.log('Height: ' + dimensions.height); 
});

However, the callback for getSupportedPictureSize passes an array of dimensions, so the documentation should be something like:

CameraPreview.getSupportedPictureSize(function(dimensions){
  // note that the portrait version, width and height swapped, of these dimensions are also supported
  dimensions.forEach(function(dimension) {
       console.log(dimension.width + 'x' + dimension.height);
  });
});

@anneb anneb changed the title incorrect documentation for method getSupportedPreviewSize incorrect documentation for methods getSupportedPreviewSize / getSupportedPictureSize Mar 5, 2017
@westonganger
Copy link
Collaborator

Thanks for clarifying these.

getSupportedPreviewSize kind of seems like an unnecessary method. Does anyone have a use case for this? If it is used for something aspect ratio wise, would a method that gets aspect ratio be more suitable?

Any other comments or suggestion you have let me know

@anneb
Copy link
Contributor Author

anneb commented Mar 6, 2017

I am using it for getting supported aspect ratio's, but I suppose I could use getSupportedPictureSize for that too? On Android, a list of supported preview sizes is passed to the callback. Would preview sizes not on the list also work?

@westonganger
Copy link
Collaborator

Yes getSupportedPictureSize could be enough for that. For Android I was wondering the same thing about "unsupported" preview sizes myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants