QuickTime player X - like timeline control (NSSlider for setting video position)
QuickTime player X - like timeline control (NSSlider for setting video position)
- Subject: QuickTime player X - like timeline control (NSSlider for setting video position)
- From: Nick <email@hidden>
- Date: Sat, 03 Nov 2012 00:06:33 +0200
Hello,
I am trying to write a customized video player, and I would like to have a
slider showing and controlling the QTMovie progress. I am using QTKit
(since I need Snow Leopard support, which is still widely used).
I have placed an NSSlider onto the view, and set it to "Continuous", so
that it sends action messages continuously when the slider is being
dragged. In the action method, I am calling QTMovie's setCurrentTime,
something like that:
-(IBAction)sliderMouseEvent:(id)sender {
NSEventType eventType = [[NSApp currentEvent] type];
NSTimeInterval duration;
QTTime time;
switch (eventType) {
case NSLeftMouseDown:
if(isPlaying)
[currentMovie stop];
case NSLeftMouseDragged:
case NSScrollWheel:
time = QTMakeTime(1000*([sender doubleValue]*currentMovieDurationInSecs),
1000);
[currentMovie setCurrentTime:time];
break;
case NSLeftMouseUp:
if(isPlaying)
[currentMovie play];
break;
default:
break;
}
}
The problem is that when the user drags the knob, the dragging is "chunky"
(especially on slow laptops), because setting the current video position is
a lengthy process.
But the QuickTime X player allows to drag its timeline's knob smoothly..
How could I do the same in my application?
Thank you
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden