Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Binju

macrumors member
Original poster
Jan 31, 2010
65
0
I want to play videos continuously(video1, video2,video3...)

I used the below code

Code:
for(int i=1;i<=n;)
	{	
     NSString *movieName = [NSString stringWithFormat:@"video%d", i];
	NSString*   movieFile = [[NSBundle mainBundle] pathForResource:movieName ofType:@"mov"];
	
	QTMovie*    aMovie = [QTMovie movieWithFile:movieFile error:nil];
	
	
	[mMovieView setMovie:aMovie];
	[aMovie autoplay];
		
			  
		i++;
		
	}

It always play the nth video only.
 
Does
Code:
[aMovie autoplay]

block? I've never used QTMovie but I'd be amazed if it did. I suspect it just starts the movie playing and returns control to your code: you need to detect the end of the movie (there are probably delegate methods for this) and then request the next movie.

Note this is all speculation: I've not opened the QTMovie documentation but I suggest you do.
 
I gone through the documentation,I cannot find the method to find the end of the movie
 
I gone through the documentation,I cannot find the method to find the end of the movie

What did you try, exactly?


I used the simplest approach I could imagine, and in less than 2 minutes found a delegate method and a notification.

First, I googled for: qtmovie reference

That took me to Apple's reference webpage:
http://developer.apple.com/mac/libr...lasses/QTMovie_Class/Reference/Reference.html

I then looked at the section on delegate methods, as previously suggested by robbieduncan. One of the delegate methods is called at the begin, update, and end phases of the movie. There are only four delegate methods, so it shouldn't be hard to figure out which one.

There is also a notification documented in the section on notifications, that is sent when the movie ends. Its name follows the normal Cocoa naming pattern, and contains "DidEnd".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.