examples icon indicating copy to clipboard operation
examples copied to clipboard

Bug when using AVLayerVideoGravityResizeAspectFill

Open warpling opened this issue 10 years ago • 0 comments

The method videoPreviewBoxForGravity:frameSize:apertureSize: should return a video box with a negative x/y origin when the videoBox width/height is greater than the frame width/height!

Here's the fix! (Lines 175-185 in DetectFace.m)

    CGRect videoBox;
    videoBox.size = size;
    if (size.width < frameSize.width)
        videoBox.origin.x = (frameSize.width - size.width) / 2;
    else
        videoBox.origin.x = -(size.width - frameSize.width) / 2;

    if ( size.height < frameSize.height )
        videoBox.origin.y = (frameSize.height - size.height) / 2;
    else
        videoBox.origin.y = -(size.height - frameSize.height) / 2;

warpling avatar Sep 05 '15 00:09 warpling