View Full Version : Playing a Quicktime Movie
kodex
2005.05.05, 11:29 AM
So I have been trowling around the web all morning looking for infomation on how to play an intro video on my upcomming project. I looked through OSC QTValue Pack it his stuff all appears to be used to play it as a texture. This is not what im looking for.
So is there an easy way to play a movie in my content window or do ihave to do it through OpenGL and play it as a texture? Any articles or source floating around?
Thanks Guys!
Puzzler183
2005.05.05, 01:34 PM
Well, it's probably fast to play it as a texture... But doesn't Apple have some sort of simple QuickTime widget or something you can use?
kodex
2005.05.05, 01:37 PM
Well i figured there was some kind of easy way to play a movie in a context i already had, I figured it would be a one line command or something of that nature. If I have to play it as a texture then i have to do all my loading stuff before I can play it and I really rather have it play right after the user selects a resoultion and such.
You guys know what im talking about right? Those nice little movies that play when you boot a game with the company logo and such, I figure it is about time i included one =D
willThimbleby
2005.05.05, 02:09 PM
If you are using cocoa, it's easy. Just create an NSMovieView at the same size as the screen in a window on top of everything else. If you are using cocoa I can just hand you some code to do it, if not I can't really help.
kodex
2005.05.05, 02:13 PM
If cocoa is my only option i will use it, I use cocoa to handle my interface and menus as is. send it my way =D
krichter@dragon-forged.com
Thanks Man!
willThimbleby
2005.05.05, 03:12 PM
This should work. I have tested it, though the busy waiting is hacky. It is also quite simple to add in a button on top of all that to get rid of it on a click.
NSRect windowRect = [[NSScreen mainScreen] frame];
NSWindow *movieWindow = [[NSWindow alloc] initWithContentRect:windowRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO screen:[NSScreen mainScreen]];
//put in front of everything
[movieWindow setLevel:NSScreenSaverWindowLevel];
//setup the movie
NSMovieView *movieView = [[NSMovieView alloc] initWithFrame:windowRect];
[movieView showController:NO adjustingSize:NO];
[movieView setMovie:[[NSMovie alloc] initWithURL:[NSURL fileURLWithPath:@"/Users/william/Desktop/3d/3DProjects/3d\ fluid/3dsmoke6.avi"] byReference:NO]];
//add it to the window
[movieWindow setContentView:movieView];
//show & play
[movieWindow makeKeyAndOrderFront:nil];
[movieView start:self];
Then in another thread, you do something like this.
//wait till done
//really bad busy waiting here
while([movieView isPlaying])
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[movieWindow close];
kodex
2005.05.05, 04:39 PM
Hmm it works for playing the movie but it dosnt use the context i had previously created, is there a way to use the context the user selects being either full screen or a custom size window and ply it within that?
Duane
2005.05.05, 04:42 PM
if you want to import it as a texture, there is an example in Developer->Examples, i think.
kodex
2005.05.05, 04:54 PM
if you want to import it as a texture, there is an example in Developer->Examples, i think.
As ive said before i really rather not because i would like it to play before i have to load all my data and as it stands now im loading all textures in a group and I would have to find a better way to do that.
But as my options are looking now I may have to go with this route,
willThimbleby
2005.05.05, 05:01 PM
An opengl context is just that, an opengl context. Only opengl content goes in there. If the context is in a window you can just bung a movieview over the top. Otherwise you can always put the window on top of the context or create the context afterwards.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.