• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Working with QTTime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: Working with QTTime (From: Christian Schneider <email@hidden>)
 >Re: Working with QTTime (From: Richard Salvatierra <email@hidden>)

  • Prev by Date: two NSArrayControllers
  • Next by Date: Re: [OT] Codename Mac OS X 10.5
  • Previous by thread: Re: Working with QTTime
  • Next by thread: Re: Renaming issues
  • Index(es):
    • Date
    • Thread