I have a question that apparently is basic. I have an Application that has a Multimedia section with videos in it (Youtube or Ted).
When you select a video (TableView) I open a modal view with a little description and, if it is a Youtube video, a webview where you must click on it to open the video. In the other case I use MPMovieController.
The problem that I have is in Youtube videos. When i close the player, my modal view is closed too and the rest of the application wichs uses modal views doesn't work (it doesn't open the modal views).
Here the code for the description view:
- (void)viewDidLoad{
[super viewDidLoad];
NSRange range = [sendVideo rangeOfString:@"youtube"];
if(range.length>0){
NSString *htmlString =[NSString stringWithFormat:@"<html><head>"
"<meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/></head>"
"<body style=\"background:#F00;margin-top:0px;margin-left:0px\">"
"<div><object width=\"212\" height=\"172\">"
"<param name=\"movie\" value=\"%@\"></param>"
"<param name=\"wmode\" value=\"transparent\"></param>"
"<embed src=\"%@\""
"type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"212\" height=\"172\"></embed>"
"</object></div></body></html>",sendVideo,sendVideo];
[youtube loadHTMLString:htmlString baseURL:nil];
}
else
{...
Here is the code I use to select the video in the TableView:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(videosContenido ==YES){
VerDetalles *vd = [[[VerDetalles alloc]initWithNibName:@"VerDetalles"
bundle:nil]autorelease];
vd.sendTitle = [aux2 objectAtIndex:[indexPath row]];
vd.sendDesc = [aux6 objectAtIndex:[indexPath row]];
vd.sendVideo = [aux4 objectAtIndex:[indexPath row]];
UINavigationController *navController= [[[UINavigationController alloc]
initWithRootViewController:vd]autorelease];
if(navController){
navController.modalPresentationStyle = UIModalPresentationFormSheet;
navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
}else {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
[self presentModalViewController:navController animated:YES];
}