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.

UIWebView YouTube player, how to detect the end of a movie? on ipad

ciaoduciaodu Posts: 3New Users


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 ::

- (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:
- (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! :confused:

best regards
Ciaodu
Post edited by ciaodu on
Sign In or Register to comment.