Re: Working with QTTime
Re: Working with QTTime
- Subject: Re: Working with QTTime
- From: Bob Ippolito <email@hidden>
- Date: Wed, 1 Jun 2005 09:44:13 -0700
That only works if they both have the same time scale, which they
probably do but don't necessarily. You should use the functions I
pointed you at to convert them to NSTimeInterval first.
-bob
On Jun 1, 2005, at 6:16 AM, Richard Salvatierra wrote:
Thanks Chris,
That worked when I cast the timeValue(s):
QTTime myCurrentTime = [theMovie currentTime];
QTTime myDuration = [theMovie duration];
float percent = ((float)myCurrentTime.timeValue / (float)
myDuration.timeValue)*100;
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)
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?
_______________________________________________
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
_______________________________________________
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