YouTube API minimum embed size changed? - youtube-api

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.

Related

How to decide 1x size for image?

I have one ImageView but the width and height are not constant. Both will change as per device width and height. (Height of ImageView is 1/3 of screen size and width is complete device width)
Example:
Proper Colors
Height
Width
iPhone SE
375
222.5
iPhone 11 Pro Max
414
298.67
iPhone 12 Pro Max
428
308.67
iPhone 12
390
281.33
As we see, width and height are varying so in this scenario what should be size for 1x image. Once we get 1x size then 2x and 3x sizes we can find easily.
Note: If width and height is fixed then I know how to find 1x, 2x and 3x.
Example: If imageView is 20x20 then, 1x = 20x20, 2x = 40x40, 3x = 60x60, But in above scenario width and height is not constant.
Note: If width and height is fixed then I know how to find 1x, 2x and 3x. Example: If imageView is 20x20 then, 1x = 20x20,2x = 40x40,3x = 60x60
#1x, #2x, #3x has more to do with the pixel density of the screen and not the size of the image. If the same sized image is displayed on a higher resolution screen then iOS will automatically choose a #3x version of the asset. Think of video quality on YouTube, a 720p and 1080p has the same size. But the 1080p video is more clear.
But in above scenario width and height is not constant.
As to dealing with the changing size of the screen, you need to decide before hand how your images should be displayed. This is a UI designing concern. UIImageView has various ContentMode options that you can use. For example,
scaleAspectFit: 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.
So if you use scaleAspectFit then on larger screen sizes you will have more blank space to the sides of the image.
Also, please take a look at Apple's Human Interface Guidelines for Image Size and Resolution and 1x, 2x and 3x Image Scaling on iOS Explained blog post.
The coordinate system iOS uses to place content onscreen is based on measurements in points, which map to pixels in the display. A standard-resolution display has a 1:1 pixel density (or #1x), where one pixel is equal to one point. High-resolution displays have a higher pixel density, offering a scale factor of 2.0 or 3.0 (referred to as #2x and #3x). As a result, high-resolution displays demand images with more pixels.
When you can fit more pixels on the same screen real-estate, you also need higher resolution images. This is where 1x, 2x and 3x come in. You provide higher resolution image files for the same assets, which are automatically selected by iOS when your app runs on a high-PPI iPhone model.

How to change resolution ratio in RTCCameraVideoCapturer

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?

Understanding image sizes in iOS

This is in regards to the pictures taken through the iPhone's camera. No matter what, I can't understand why image sizes are in the order of 1000s and image scale always 1.0.
For example, I printed out an image's details and this is what I got:
<UIImage: 0x134def110> size {3024, 4032} orientation 3 scale 1.000000
What does 3024x4032 mean? And why is the scale 1.0, when my screen size is really 375x667? Orientation 3 means the image is roated 90º counterclockwise. So if the original image is 375x500 (in pixels), after rotation it should be 500x375. Then why does the size shown not change accordingly?
And on a similar note, how would I get the size of the image in pixels from this size that's printed out? Because no matter what the size of the camera preview, if the ratio of the camera preview is 4:3, the resulting size of the image (image.size.width and image.size.height) is always 3024x4032.
What does 3024x4032 mean?
Those are the dimensions of the image. I think you're missing one point: the iPhone's camera can take photographs with a much higher resolution than its screen size. Just because an image is shown on the screen, it doesn't mean the image dimensions are that size.
Size: An uncropped, landscape 12.2MP photo (that's default size when shot on the iPhone 7 rear camera) is 3024 * 4032 pixels, so that's where that number comes from. Extra crispy in case you want to frame it and hang it up on your wall! See source.
Scale: Generally 1.0 (or 100%), it's the magnitude of which you've reduced your image file size. So if you wanted a 50% smaller file, you could scale the image down to 0.5 (50%), obviously losing some quality in the process.
tl;dr: those dimensions are the scale of the photo in storage, not the dimensions at which it's rendered on the phone.

AVPlayer: How come iPhone videos don't get distorted when aspect size varies for video and device?

For instance assume you capture a video at 360x480 resolution using AVCaptureSessionPresetMedium and render it with AVPlayerLayer with videoGravity of AVLayerVideoGravityResizeAspectFill. The video renders full screen, without distortion, on 5S devices.
5S devices have a resolution of 320x568, so shouldn't a 360x480 video get stretched vertically or shrunk horizontally?
How does the scaling work so that the aspect size is preserved even though the aspect size of the video differs from the aspect size of the device?
New to AVFoundation and video, so help is much appreciated.
Set your videoGravity to AVLayerVideoGravityResizeAspect.It preserved the aspect size by stretched vertically or shrunk horizontally

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