How to change resolution ratio in RTCCameraVideoCapturer - ios

How can I change the resolution ratio in RTCCameraVideoCapturer?
I choose a AVCaptureDevice.Format, and the resolution ratio is 1280*720. I want to preview it on a fullfill screen view. How can I change the resolution ratio 1280*720 into 1334*750. Should I zoom or something else?

Related

UIImageView constraint to be 1:1 aspect ratio and 1:1 scaled to original?

Is there any simple way to achieve a 1:1 aspect ratio and scale to the original image inside an ImageView ?
I don't want only to keep the Image aspect ratio, I want it to be exactly the same size as the underlying image (1:1 scale also to original)... not smaller, not bigger... so it will be 1:1 on screen in therms of pixels or UIKit points or w/e with the original (scaling 1).
If you only set aspect ratio, the image might scale up or down, whilst keeping aspect ratio. I want to prevent this behaviour and to tell it not to scale.
How can I set the scale to be 1 as a constraint ? Is there any way in doing this, without any hardcoding on width / height constraints to match the size of the original image ?
Basically I want to tell the autolayout... here is the image, don't touch it, never scale it no matter what, let it be exactly as the original (scaling 1).
UPDATE:
The only way I could achieve this is by setting the hugging / compression priorities to higher than other items in the layout. Only setting aspect ratio constraint doesn't do it... I think there is no other way to ensure this behaviour without touching compression / hugging priorities.
Don't put any height or aspect ratio constraint to your UIImageView just put the width constraint or leading and trailing constraint whatever suits your need. And make contentMode AspectFill.
ImageView will scale automatically to match the aspect ratio of the image it holds. However make sure to have a height <= the maximum height you should have(In the images below I should put height <= the screen height) so that the image doesn't go beyond the desired bounds.
Set the contentMode to aspectFit.
See Apple official documentation :
The option to scale the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.
Try setting the ContentMode of your ImageView as Center.
Also remember to set clip to bounds.
imageView.clipsToBounds = true
imageView.contentMode = .center

(iOS) What resolution image for an image view with proportional constraints?

If I create an image view that has constraints that are proportional to the size of the screen. I can't decide the exact dimensions of image I need to supply for any of x1, x2 or x3. I understand how image sets work. But it's figuring out the dimensions I need because when I the following code I get slightly different dimensions for every device I test on:
print(imageView.bounds.size.width)
print(imageView.bounds.size.height)
Different x2 devices like the iPhone 5 and iPhone 6 will give me slight differences. But because they receive the same image, will it not look different?
Add an Aspect Ratio constraint on your UIImageView to make sure you don't stretch the image.
Use Aspect Fill or Aspect Fit content mode for UIImageView.
Keep the biggest image for each scale factor (2x, 3x). Basically, there are multiple device resolutions for 2x scale factor, so #2x image should have resolution designed for iPhone 6 and it will be automatically downscaled on smaller devices (iPhone 5/4s). 3x image should have resolution for

How to change camera's aspect ratio in IOS?

I working on ios app. My application can take photo, I need change camera's aspect ratio to 1:1.
How to change the aspect ratio on iOS ?

YouTube API minimum embed size changed?

All the docs I've seen say that the minimum player size is 200x200, but when I attempt to embed http://www.youtube.com/watch?feature=player_embedded&v=RByVyVvMpQI I get the following message in the Flash Player log:
info Error: player size set to 300x220 which is below minimum dimensions 320x60
Have the requirements changed? Is it possible for the video owner to set a minimum? WTF?
In the youtube api documentation it is mentioned as.
To allow room for critical player functionality, players must be at least 200px by 200px.
But in the JavaScript player documentation it is mentioned that the minimum player size varies with the Video quality.
Quality level small: Player height is 240px, and player dimensions are at least 320px by 240px for 4:3 aspect ratio.
Quality level medium: Player height is 360px, and player dimensions are 640px by 360px (for 16:9 aspect ratio) or 480px by 360px (for 4:3 aspect ratio).
Quality level large: Player height is 480px, and player dimensions are 853px by 480px (for 16:9 aspect ratio) or 640px by 480px (for 4:3 aspect ratio).
Quality level hd720: Player height is 720px, and player dimensions are 1280px by 720px (for 16:9 aspect ratio) or 960px by 720px (for 4:3 aspect ratio).
Quality level hd1080: Player height is 1080px, and player dimensions are 1920px by 1080px (for 16:9 aspect ratio) or 1440px by 1080px (for 4:3 aspect ratio).
Quality level highres: Player height is greater than 1080px, which means that the player's aspect ratio is greater than 1920px by 1080px.
There is a possibility that you may be playing a video in a player which doesn't meet the above expectations.Please refer this(under heading Playback quality) for more info.

iPhone gallery app crops photo to 3:2 from 4:3 aspect ratio, how?

The photo taken using the UIImagePickerController is of 4:3 aspect ratio. However, the full screen aspect ratio is 3:2. So the gallery app is doing some magic to show the photo as 3:2 aspect ratio. When you zoom out in the full screen view, the photo appears in 4:3 aspect ratio. Can anyone shed light on how it could be done? I've been breaking my head for the past two weeks on this.
Really appreciate the help!!
To fit a 4:3 image into a 3:2 space you can either match the height or match the width.
If you were to match the height then you'd turn the 3 in 4:3 into the 2 in 3:2. So you'd scale the entire image by 2/3. Since you'd be scaling width and height by the same amount, the effective height after scaling would be the 4 from 4:3 scaled by 2/3, to give 8/3 — a bit less than three. You'd therefore not quite fill the screen.
Conversely, if you were to match the width then you'd turn the 4 in 4:3 into the 3 in 3:2. So you'd scale the entire image by 3/4. Since you'd be scaling width and height by the same amount, the effective height at the end would be the 3 from 4:3 scaled by 3/4, to give 9/4 — a bit more than two. You'll therefore slightly more than fill the screen.
So that the photos app does is display pictures with an initial zoom so as to fit the width of the stored image to the width of the display. If the stored image is 3264x2448 (which I think it is on the iPhone 4S and the 5) then on an iPhone 4s — using points rather than pixels — it's scaled by a ratio of 480/3264. If you work that out, it gives the image a final height of very close to 360pt, 40pt wider than the screen.
In terms of UIKit, that probably means putting a UIImage inside a UIScrollView and setting the initial value of zoomScale to 480/3264 (ie, approximately 0.15). The scroll view can help you with zooming in and out though there's still some manual work to be done — see e.g. this tutorial. By setting a minimumZoomScale of 320/2448 (ie, approximately 0.13) you'll automatically get the behaviour where zooming out as far as you can go ends up showing the entire 4:3 image on screen.
not sure how you obtain your image, but you might have gotten one of the representations of the image. One of those representations is specifically for getting a quick fullScreen CGImage, an other will return the FullResolution. FullScreen will be whatever is needed for the device (640x960 on iPhone4), Full resolution would be the 8MP picture.

Resources