开发者

How to get iphone movie player handler (UIWindow handler)

开发者 https://www.devze.com 2022-12-19 14:49 出处:网络
I am trying to play a video like this self.webView = [[UIWebView alloc] initWithFrame: CGRectMake(0.0, 0开发者_运维技巧.0, 1.0, 1.0)];

I am trying to play a video like this

self.webView = [[UIWebView alloc] initWithFrame: CGRectMake(0.0, 0开发者_运维技巧.0, 1.0, 1.0)];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL: urlToMovie];
[self.webView loadRequest: request];
[request release];

could anyone tell me how can i get moviePlayerWindow (UIWindow ) handler if i am playing with the help of safari.

Is there any way to get movie notifications? like did finish loading, finish playing etc.

thank you for your responses :)


NSArray *windows = [[UIApplication sharedApplication] windows]; 

if ([windows count] > 1) {  // Locate the movie player window  
   UIWindow * moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];    
 // ... and now you can add views and play around with the window directly
} 

There is only one notification you can get at.

http://www.iphonedevsdk.com/forum/iphone-sdk-development/26322-all-mpmovieplayercontroller-notifications.html


Skip the UIWebView and use MPMoviePlayerController directly, which provides the following notifications:

MPMoviePlayerContentPreloadDidFinishNotification Notifies observers that the movie is now in memory and ready to play. The affected movie player is stored in the object parameter of the notification. If an error occurred during loading, the userInfo dictionary of this notification contains a key with the name “error” whose value is the NSError object describing the problem.

MPMoviePlayerPlaybackDidFinishNotification Notifies observers that the movie finished playing. The affected movie player is stored in the object parameter of the notification.

MPMoviePlayerScalingModeDidChangeNotification Notifies observers that the scaling mode property of the player changed. The affected movie player is stored in the object parameter of the notification. User actions may also cause the media player to send this notification.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号