iOS support for multiple instances of YouTube player
I'm looking for some follow up information on this question:
https://groups.google.com/forum/#!topic/youtube-api-gdata/EgOhevwh5FA
I'm trying to play more than one YouTube video in an iOS application, and
it seems like there is an iOS limitation in doing this. I have two
separate web views loading two different YouTube videos. You can start and
play one, but when you go to play the second one, the first one
automatically stops. You can then go back and forth between the two, but
you can never get two (or more?) to play back at the same time.
I'm fearing this might be an iOS limitation...does anyone know the status
on this?
Thanks so much for any help!
Here is code in case you want to test and try it out. This works fine in
the iOS iPad simulator. I'm using iOS6.1.
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, atomic) UIWebView *wv;
@property (strong, atomic) UIWebView *wv2;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize wv, wv2;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
wv = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 370, 250) ];
[wv loadHTMLString:@"<html><body><iframe class=\"youtube-player\"
type=\"text/html\" width=\"360\" height=\"240\"
src=\"http://www.youtube.com/embed/fMHj3U3-RA4?HD=0;rel=0;showinfo=0\"
allowfullscreen=\"false\" frameborder=\"0\"
rel=nofollow></iframe></body></html>" baseURL:nil];
[self.view addSubview:wv];
wv2 = [[UIWebView alloc]initWithFrame:CGRectMake(0, 300, 370, 250) ];
[wv2 loadHTMLString:@"<html><body><iframe class=\"youtube-player\"
type=\"text/html\" width=\"360\" height=\"240\"
src=\"http://www.youtube.com/embed/bQWxxdGsSSk?HD=0;rel=0;showinfo=0\"
allowfullscreen=\"false\" frameborder=\"0\"
rel=nofollow></iframe></body></html>" baseURL:nil];
[self.view addSubview:wv2];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
No comments:
Post a Comment