Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-13-2011, 10:45 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 3
ciaodu is on a distinguished road
Exclamation UIWebView YouTube player, how to detect the end of a movie? on ipad



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
ciaodu is offline   Reply With Quote
Old 02-14-2012, 06:30 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 3
ciaodu is on a distinguished road
Default no help?

no help?

anyone?
ciaodu is offline   Reply With Quote
Reply

Bookmarks

Tags
ipad, mpmovieplayer, nsnotificationcenter, uiwebview, youtube

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 314
6 members and 308 guests
chemistry, Dnnake, iOS.Lover, lendo, Leslie80, pbart
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:23 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0