Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Video Array in iOS 5 and using MPMoviePlayerController, is it possible?

MarcoAlmeidaMarcoAlmeida Posts: 6New Users
edited February 2012 in iPhone SDK Development
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.
Post edited by MarcoAlmeida on

Replies

  • Duncan CDuncan C Posts: 8,147Tutorial Authors, Registered Users
    edited February 2012
    MarcoAlmeida;407782 said:
    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

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • MarcoAlmeidaMarcoAlmeida Posts: 6New Users
    edited February 2012
    Duncan C;407797 said:
    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.
  • Duncan CDuncan C Posts: 8,147Tutorial Authors, Registered Users
    edited February 2012
    MarcoAlmeida;407805 said:
    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.:

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

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

    Duncan C
    WareTo

    mug

    Animated GIF created with Face Dancer, available for free in the app store.
  • MarcoAlmeidaMarcoAlmeida Posts: 6New Users
    edited February 2012
    It finally Works!!!!!!!!!!!!!

    Thank you very much Duncan!!!!

    Best regards!!!!
  • erumerum Posts: 3New Users
    @MarcoAlmeida
    pls help me how u have made an array of video file i m novice facing difficulty to do this pls share the code or just let me know any tutorial
    pls send me at:
    erumhannan.ned@gmail.com
Sign In or Register to comment.