Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Duration of movie clip
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Duration of movie clip



You'd need to see if the QTDrawable is an instance of a quicktime.app.players.Playable

that has a getDuration call which returns a duration in the scale of the playable - use getScale.

Thus
if (myQTContent instance of Playable) {
Playable myPlayer = (Playable)myQTContent;
float timeInSecs = myPlayer.getDuration() / (float)myPlayer.getScale();
return timeInSecs;
} else
return 0;// no duration -> ie. a still image for instance

Bill

On Friday, September 7, 2001, at 06:48 AM, Mark Cunningham wrote:

Hi,
Thanks to responses from people on this mailing list I have managed to
convert my JMF code to Quicktime and my application plays movie clips
perfectly.....except I need to be able to work out the duration of a new
movie clip.

I have seen in the docs that the class Movie has a method getDuration, but I
am using a canvas to display my movie (see code below).

Can anyone tell me how I can get the duration of this movie. Please keep it
simple as my Java skills are intermediate at best.

Thanks

Mark

public MovieScreen(QTFile movieName) throws QTException
{
try
{
canvas = new QTCanvas(QTCanvas.kInitialSize, 0.5F,
0.5F);

Drawable myQTContent = QTFactory.makeDrawable
(movieName);
canvas.setClient (myQTContent, true);

}
catch (IOException ioe) {}
catch (QTException e) {}

}

//_________________________ INSTANCE VARIABLES
private QTCanvas canvas;
private QTDrawable qtp = null;

[demime 0.98b removed an attachment of type application/ms-tnef which had a name of winmail.dat]
_______________________________________________
quicktime-java mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/quicktime-java


mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
Cat: "Leave me alone, I'm trying to nap... Ah, What's that clicking noise?"
__________________________________________________________________________




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.