Re: Working with QTTime
Re: Working with QTTime
- Subject: Re: Working with QTTime
- From: Christian Schneider <email@hidden>
- Date: Wed, 1 Jun 2005 09:53:41 +0200
Richard,
On 5/31/05, Richard Salvatierra <email@hidden> wrote:
> Disclaimer - New to Objective-C
> I am trying to use the ProgressView / Cell class from the developer sample
> code to create a progress bar for a QTMovie.
> I want to get the status of the movie as a percent from currentTime /
> Duration but do not understand QTTime. Code:
> NSDictionary *myAtts = [theMovie movieAttributes];
> NSValue *durationValue = [myAtts objectForKey:
> QTMovieDurationAttribute];
> NSValue *currentValue = [myAtts objectForKey:
> QTMovieCurrentTimeAttribute];
> How do I get a float value from an NSValue?
you can use -duration and -currentTime on your movie. Both will return
a QTTime like so:
QTTime duration = [movie duration];
QTTime currentTime = [movie currentTime];
The struct QTTime has the fields timeValue and timeScale, the first
one being a long long, the second one a long. So to get your
percentage:
float percentage = currentTime.timeValue / duration.timeValue; (am not
sure whether a cast to float for the longs will be necessary)
chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden