Search code examples
iphoneipadios4uiwebviewuiimagepickercontroller

ipad camera and webview youtube video playing issue


Rootviewcontroller has a webview that plays a youtube video and it has one camera button. User can click on camera button and record video. up to this point its working fine

When I dismiss the camera controller and try to play the video in webview, its frame gets disturbed even though I tried removing and again adding on view.

When I dismiss the camera controller without recording the video its working ok... Here is the imageenter image description here code to play video

 GDataEntryBase *entry2 = [[AppDelegate.feed entries] objectAtIndex:[tag intValue]];
    NSArray *contents = [[(GDataEntryYouTubeVideo *)entry2 mediaGroup] mediaContents];
   NSString *urlString=[NSURL URLWithString:[[contents objectAtIndex:0] URLString]];

    NSString *embedHTML = @"\
    <html><head>\
    <style type=\"text/css\">\
    body {\
    background-color: black;\
    color: black;\
    }\
    </style>\
    </head><body style=\"margin:0\"><div>\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"736\" height=\"571\"></embed></div>\
    </body></html>";
    NSString *html = [NSString stringWithFormat:embedHTML, urlString, webplay.frame.size .width, webplay.frame.size.height];
    NSLog(@"html=%@",html);
        [webplay loadHTMLString:html baseURL:nil];

Solution

  • I did check but it was layer problem I used hit test to solve this problem.

    Here is a link that show how to use hit test