Video Array in iOS 5 and using MPMoviePlayerController, is it possible? (SOLVED)
I am trying to implement a set of videos on this app I am developing, but since I am not an experienced developer I came here to as the help of others.
Well, the app is a simple PS3 games database for iPhone using TableView.
The table has an array with the game tittles and when I click on a row it loads the cover of the game and two buttons: one for the info on the game and the other one to load a demo video of the respective game.
As you might know, I created an array to store the name of the games, the filename of the cover image and the description.
So, when I click on the row for, example Assassinīs Creed II, it will show the corresponding cover and clicking the info button will show me a brief description of the game.
But the problem is that I donīt know how I can add the video the same way I did with the image..
I managed to play the video using the MPMoviePlayerController, but I had to specify the video, and had no option to specify a possible array of videos..
So, I ask, is it possible to create a video array and work the same way I did with the cover images???
Thank you in advance, Marco Almeida.
Last edited by MarcoAlmeida; 02-08-2012 at 01:28 PM.
I am trying to implement a set of videos on this app I am developing, but since I am not an experienced developer I came here to as the help of others.
Well, the app is a simple PS3 games database for iPhone using TableView.
The table has an array with the game tittles and when I click on a row it loads the cover of the game and two buttons: one for the info on the game and the other one to load a demo video of the respective game.
As you might know, I created an array to store the name of the games, the filename of the cover image and the description.
So, when I click on the row for, example Assassinīs Creed II, it will show the corresponding cover and clicking the info button will show me a brief description of the game.
But the problem is that I donīt know how I can add the video the same way I did with the image..
I managed to play the video using the MPMoviePlayerController, but I had to specify the video, and had no option to specify a possible array of videos..
So, I ask, is it possible to create a video array and work the same way I did with the cover images???
Thank you in advance, Marco Almeida.
You have an array of image filenames. Add an entry for the video filename as well, and use that to load the video into your movie player controller.
Video files are quite large, and you don't want to load all of them into memory. Instead, just track the filename, and pass that to your movie player when the user selects it.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
You have an array of image filenames. Add an entry for the video filename as well, and use that to load the video into your movie player controller.
Video files are quite large, and you don't want to load all of them into memory. Instead, just track the filename, and pass that to your movie player when the user selects it.
Thanks for the reply!
Actually I did this before but the problem was that the MPMoviePlayerController class requires that I use an specific way of calling the video like it separates the name of the video from its extension: pathForResource:@"assassinscreed2" of Type:@"mov" .
And that way is diferent from what I have with loading the images which I was able to load them using indexPathForSelectedRow, objectAtIndex:row, and the image associated with the game in the corresponding row.
So I was wondering if I could use the procedure I did with images to the videos, pointing the row I selected to the video file, stored in an array.
Actually I did this before but the problem was that the MPMoviePlayerController class requires that I use an specific way of calling the video like it separates the name of the video from its extension: pathForResource:@"assassinscreed2" of Type:@"mov" .
And that way is diferent from what I have with loading the images which I was able to load them using indexPathForSelectedRow, objectAtIndex:row, and the image associated with the game in the corresponding row.
So I was wondering if I could use the procedure I did with images to the videos, pointing the row I selected to the video file, stored in an array.
NSString has methods that let you separate out the extension, or get a path without the extension.
I would suggest saving the filename with extension into your array, then use stringByDeletingPathExtension to get the filename without the extension, and pathExtension to get just the extension, e.g.:
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.