• 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: 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

  • Follow-Ups:
    • Re: Working with QTTime
      • From: Richard Salvatierra <email@hidden>
  • Prev by Date: Re: [OT] Codename Mac OS X 10.5
  • Next by Date: Re: Renaming issues
  • Previous by thread: [Moderator] EOT Re: [OT] Codename Mac OS X 10.5
  • Next by thread: Re: Working with QTTime
  • Index(es):
    • Date
    • Thread