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

Ruler Video Frame Not matching with Video player #19

Open
simbu-anubavam opened this issue Jun 17, 2016 · 2 comments
Open

Ruler Video Frame Not matching with Video player #19

simbu-anubavam opened this issue Jun 17, 2016 · 2 comments

Comments

@simbu-anubavam
Copy link

Hi ,
I am trying to using your video trim library into the demo project,
But i have noticed the getting issue like Ruler frame is not matching with the Playing video,
Can you guide me to resolve this?

@itsmeichigo
Copy link
Owner

itsmeichigo commented Jun 20, 2016

Hi, if you're talking about the preview frames of the video in the trimmer view, these frames don't necessarily reflect the exact frames being shown in the video. They're the first frames of the video within certain duration they're indicating. I know my explanation's a little bit complicated but I hope you get my point.

@simbu-anubavam
Copy link
Author

simbu-anubavam commented Jun 20, 2016

Hi,
Yes, i can get your point, But the issue was the video plays the frame which is need to play after 2 frames for 10 minutes video,
Today I've made few change on your code,
like below,
instead of passing durationPerFrame i have calculated delta , because durationPerFrame was higher than the needed value, I have passed it for the CMTimeMakeWithSeconds , Now the frames is some what matching

changes on the below method, ICGVideoTrimmerView.m

  • (void)addFrames

<

CGFloat delta = picWidth /  self.widthPerSecond;
int preferredWidth = 0;
NSMutableArray *times = [[NSMutableArray alloc] init];
for (int i=1; i<actualFramesNeeded; i++){
    CMTime time = CMTimeMakeWithSeconds(i*delta, 600);
    [times addObject:[NSValue valueWithCMTime:time]];

    UIImageView *tmp = [[UIImageView alloc] initWithImage:videoScreen];
    tmp.tag = i;

    CGRect currentFrame = tmp.frame;
    currentFrame.origin.x = i*picWidth;

    currentFrame.size.width = picWidth;
    preferredWidth += currentFrame.size.width;

    if( i == actualFramesNeeded-1){
        currentFrame.size.width-=6;
    }
    tmp.frame = currentFrame;

    dispatch_async(dispatch_get_main_queue(), ^{
        [self.frameView addSubview:tmp];
    });
}

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