Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-08-2012, 10:45 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2012
Location: Campina Grande/Brazil
Posts: 4
MarcoAlmeida is on a distinguished road
Default 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.
MarcoAlmeida is offline   Reply With Quote
Old 02-08-2012, 11:51 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by MarcoAlmeida View Post
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.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 02-08-2012, 12:04 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2012
Location: Campina Grande/Brazil
Posts: 4
MarcoAlmeida is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
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.
MarcoAlmeida is offline   Reply With Quote
Old 02-08-2012, 01:00 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by MarcoAlmeida View Post
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.
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.:

Code:
NSString *fullFileName = @"assassinscreed2.mov";
NSString *filename = [fullFileName stringByDeletingPathExtension];
NSString *extension = [fullFileName pathExtension];

NSString *bundlePath =  
  [[NSBundle mainBundle] pathForResource: filename 
  ofType:extension];
.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 02-08-2012, 01:26 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2012
Location: Campina Grande/Brazil
Posts: 4
MarcoAlmeida is on a distinguished road
Thumbs up

It finally Works!!!!!!!!!!!!!

Thank you very much Duncan!!!!

Best regards!!!!
MarcoAlmeida is offline   Reply With Quote
Reply

Bookmarks

Tags
array, ios, mpmovieplayercontroller, tableview, video

Thread Tools
Display Modes

Posting 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



» Advertisements
» Online Users: 388
12 members and 376 guests
7twenty7, chiataytuday, fiftysixty, gmarro, iOS.Lover, KennyChong, kilobytedump, Leslie80, Matrix23, ryantcb, stanny, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:22 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0