iPhone SDK Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingiPhone SDK Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 17th, 2010, 05:14 PM
CeiJay CeiJay is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 1 CeiJay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 41 sec
Reputation Power: 0
UITableViewCell - Play Multiple Movie Files from an Array

Hello All

iOS4 - iPhone 4 & 3GS

I have a Table based application using Custom UITableViewCell's. The custom Cell has a UIButton within it for playing a movie file. At the moment I have Arrays to populate the information within each cell depending on the Indexpath. All information within the Cell is placed within cellForRowAtIndexPath and all actions are within didSelectRowAtIndexPath.

The UIButton within each cell plays a movie using the standard MoviePlayerViewController like so (other code not shown)

Code:
- (void)loadMoviePlayer

{

// Play movie from the bundle NSString *path = [[NSBundle mainBundle] pathForResource:@"Mov2" ofType:@"mp4" inDirectory:nil];

// Create custom movie player
moviePlayer = [[[CustomMoviePlayerViewController alloc] initWithPath:path] autorelease];

// Show the movie player as modal [self presentModalViewController:moviePlayer animated:YES];

// Prep and play the movie [moviePlayer readyPlayer];
}


The UIButton within the CustomCell is linked to the following:

Code:
-(IBAction)playMovie {

[self loadMoviePlayer];
}


Here is an example of Audio being played within didSelectRowAtIndexPath. A Array controllers the stringWithFormat using the TabelView IndexPath. Each Cell plays a certain file...

Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSUInteger row = [indexPath row]; NSString *rowTitle = [filmSound objectAtIndex:row];

NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], rowTitle]]; NSError *error; AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];

if (player != nil) { [self setTheAudio: player]; [player release], player = nil;

[self.theAudio setDelegate:self];

[self.theAudio play]; }

[tableView deselectRowAtIndexPath:indexPath animated:YES]; }

I need to be able to do the same the the movie file actioned by the UIButton in the CustomCell. The - (void)loadMoviePlayer code will not work as an Indexpath is not defined. Have it in didSelectRowAtIndexPath still will not allow me to get the Array working.

Options in my brain right now... 1. Change the - (void)loadMoviePlayer to include the indexPath as a ref and change the pathForResource to handle the Array. 2. Change the - (void)loadMoviePlayer to include the indexPath as a ref and use an if / else statement will blocks of the MoviePlayer code to repeat the process using (indexPath.row % 2 == 0)

Recap... UITableView with CustomCell using Array to populate cell information and didSelectRowAtIndexPath need MoviePlayer which is attached to a UIButton within the CustomCell to be played depending on the IndexPath / Cell.

Your help would be gratefully appreciated. Any question please feel free to ask. Thank you in advance.

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingiPhone SDK Development > UITableViewCell - Play Multiple Movie Files from an Array

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap