Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSMoviewView never !isPlaying?

NSMoviewView never !isPlaying?
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Oct 13, 2001, 11:32 PM
 
Okay, so I created this nice NSMovieView object that I can play NSMovies in. aiff and mp3 files are coming out great. I didn't add it into any contentViews cause I wanted to control it entirely programatically. So, I wanted my NSMovieView to start playing another song after it gone done with whatever it is playing now. To check that, I probably should just call isPlaying(). Hmm... the only thing is, it always returns true unless I manually call stop off of my NSMovieObject. So, how do I know when my NSMovieView object is done playing it's current movie? Is there a way?

Thanks,
F-bacher
     
Fresh-Faced Recruit
Join Date: Jun 2001
Location: Pleasant Valley, NY
Status: Offline
Reply With Quote
Oct 14, 2001, 02:36 PM
 
You can try using the regular QT callbacks (though I've found problems where the callback isn't always called, even if it is set up properly). I've also only used it with movies, never sounds. But it's worth a try. The code to set up the callback looks something like:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
TimeBase tb = GetMovieTimeBase([[movieView movie] QTMovie]);
QTCallBackUPP movieStoppedUPP = NewQTCallBackUPP(&MovieStopped);
QTCallBack movieStoppedCallBack = NewCallBack(tb, callBackAtExtremes);
CallMeWhen(movieStoppedCallBack, movieStoppedUPP, (long) self, triggerAtStop, NULL, NULL);
</font>[/code]

This will pass self as an argument to the callback function. All these functions are in the QuickTime documentation, so take a look - hopeflly this will point you in the right direction.

Matt
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Oct 14, 2001, 03:30 PM
 
Originally posted by mreda:
<STRONG>You can try using the regular QT callbacks (though I've found problems where the callback isn't always called, even if it is set up properly). I've also only used it with movies, never sounds. But it's worth a try. The code to set up the callback looks something like:

&lt;BLOCKQUOTE&gt;&lt;font size="1"face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;HR&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt;
TimeBase tb = GetMovieTimeBase([[movieView movie] QTMovie]);
QTCallBackUPP movieStoppedUPP = NewQTCallBackUPP(&MovieStopped);
QTCallBack movieStoppedCallBack = NewCallBack(tb, callBackAtExtremes);
CallMeWhen(movieStoppedCallBack, movieStoppedUPP, (long) self, triggerAtStop, NULL, NULL);
&lt;/font&gt;&lt;/pre&gt;&lt;HR&gt;&lt;/BLOCKQUOTE&gt;

This will pass self as an argument to the callback function. All these functions are in the QuickTime documentation, so take a look - hopeflly this will point you in the right direction.

Matt</STRONG>
The only catch is that in the Java version of NSMovie, there is no method called QTMovie(). I wonder if I could send my NSMovie object an objective-C message? I think I read about that somewhere in the docs. I'll see what I can do with this info.

Thanks,
F-bacher
     
Fresh-Faced Recruit
Join Date: Jun 2001
Location: Pleasant Valley, NY
Status: Offline
Reply With Quote
Oct 15, 2001, 12:31 AM
 
I didn't realize you were working in Java. I think there is some kind of bridge between java and ObjC, but I don't know the details.

Matt
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Oct 15, 2001, 12:45 PM
 
Arggh! This is so frustrating. I'm trying to figure out how to use the QuickTime API's to use a regular Java QT object, but where the hell are they? I have the intro thing, but I can't find them.

Alright, so I can import the QuickTime framework into my project, that's easy. But I'm looking at these header files and getting nothing that looks decipherable (sure it's code, but nothing I can read).

All I need to do is use the QuickTime API's to start playing a song and stop when I tell it to or if it reaches the song. That's it! Does anyone have any insight on how I would do this? I'm so lost.

Thanks,
F-bacher
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Oct 18, 2001, 06:14 PM
 
Finally! Here's all I had to do: add my NSMovieView object to an open window. Not a closed window. It had to be an open window. Then isPlaying worked fine. Why? I have no idea. Since I didn't want the enduser to see the NSMovieView, I made the NSWindow transparent, and now I'm very happy.

F-bacher
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 19, 2001, 01:00 PM
 
Originally posted by Ghoser777:
<STRONG>Since I didn't want the enduser to see the NSMovieView, I made the NSWindow transparent, and now I'm very happy.</STRONG>
It would probably be a better solution to make it offscreen instead of transparent, less hackish at any rate
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2