开发者

Play youtube video on iPhone by not pressing the default video icon

i want to know if it is possible to launch the youtube video without launching the 开发者_开发问答default small photo icon. I just need a regular icon which is able to be launched to play a youtube video. Unfortunately, as the Youtube official suggestion suggests, there is currently no way to fulfill my request. Does any body concern this issue and already figure this out?

http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html


if I understood your question correctly:

  1. embed youtube player in a UIWebview and set the webview to hidden
  2. in your customized button method do the following:

    a- search for UIButton in the webview subviews :

-(UIButton*)getButtonInView:(UIView*)view{

UIButton *button = nil;
     if([view isMemberOfClass:[UIButton class]]){
      return (UIButton*) view;
     }

 if(view.subviews && [view.subviews count] > 0) {
  for(UIView *subview in view.subviews) {
   button=[self getButtonInView:subview];
   if(button) return button;
  }
 }

 return button;

}

b- send action to the fetched button:

[button sendActionsForControlEvents:UIControlEventTouchUpInside];

hope that will help

----NOTE----

As mentioned by lxt. Please note that that this solution relies on Youtube plugin implementation not changing otherwise it might break in the future.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜