Hey fellow developers.
My question is this, how would one go about getting an "end of movie notification" on a embedded youtube video?
I have embedded a Youtube video in a webview, i followed
this tutorial. this is the code ::
Code:
- (void)embedYouTube:(NSString*)url frame:(CGRect)frame {
NSString* embedHTML = @"\<html><head>\<style type=\"text/css\">\body {\background-color: transparent;\color: white;\
}\</style>\</head><body style=\"margin:0\">\<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \width=\"%0.0f\" height=\"%0.0f\"></embed>\</body></html>";
NSString* html = [NSString stringWithFormat:embedHTML, url,frame.size.width, frame.size.height];
if(videoView == nil) {
videoView = [[UIWebView alloc] initWithFrame:frame];
[self.view addSubview:videoView];
}
[videoView loadHTMLString:html baseURL:nil];
}
i read in
this post how to get "end of movie notfication" on the iphone. But this method dosen't work on the ipad(cause it dosent open in the native mpmovieplayer, it opens directly in the webview).
this is the code for getting notification on iphone:
Code:
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowHidden:)
name:UIWindowDidBecomeHiddenNotification
object:self.view.window
];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowVisible:)
name:UIWindowDidBecomeVisibleNotification
object:self.view.window
];
}
- (void)windowNowVisible:(NSNotification *)note
{
NSLog(@"YouTube window went away");
}
- (void)windowNowHidden:(NSNotification *)note{
NSLog(@"YouTube window took over");
}
is there any ways of getting the "e.o.m. notfication" when the embedded movie is done playing in the webview?
i need this bad amigos!
best regards
Ciaodu