rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

SCImageView #322

Open xMonty opened 8 years ago

xMonty commented 8 years ago

First of great library!

I am adding live filters using

filterSwitcherView.loadContextIfNeeded() recorder.SCImageView = filterSwitcherView

preview is fine but i dont get any output when i write the video so i added another UIView as preview and set it as hidden (hacky i know)

recorder.previewView = ppView; //<--ppView is hidden, this produces output video file which is fine

now the output is fine as well

last hurdle is if i resize to a square video filterSwitcherView <- square this ppView<- square this and i call recorder.previewViewFrameChanged()

but there is no function for SCImageViewFrameChanged() so the preview looks squished

i tried adding filterSwitcherView.contentMode = .Center but doesnt help

how do i tell SCRecorder that the SCImageView's size has been changed basically equivalent function for previewViewFrameChanged for SCImageView instead of previewView

rFlex commented 8 years ago

Hey there,

In theory there is no need for calling frameChanged() on the SCImageView. The frameChanged() method is just a workaround to resize the backing AVPlayerLayer so it fits its view. Could you please make an example project showcasing the bug? It makes it much easier for me to fix it. Thank you so much!

xMonty commented 8 years ago

I have isolated the issue pretty much

instead of having frameChanged to notify SCImageView that the frame is changed you could use

filterSwitcherView.scaleAndResizeCIImageAutomatically = true filterSwitcherView.contentMode = .ScaleAspectFill

recorder.SCImageView = filterSwitcherView

now whenever you resize filterSwitcherView (e.g. goto square mode) SCImageView uses .contentMode to fill it but that will cause the entire video to be squished in to the SCImageView i just wanted the center part of the video

for that if i could set contentMode to .Center it would solve the issue

but SCImageView's function

only has cases for "UIViewContentModeScaleAspectFill" and "UIViewContentModeScaleAspectFit"

if it had cases for "UIViewContentModeCenter" and others then the implementation would be complete

i wouldnt classify this as a bug but rather missing functionality

will get a working project to demonstrate this in a few hours

renjithn commented 8 years ago

Possibly related to #265