title: Playing Youtube Video in iframe in UIWebView
body: <p>Hello I'm parsing html string into web view and here is how I check for youtube videos and add them to iframe:</p>
  
  <pre><code>- (NSString *)extendYouTubeSupportInHtml:(NSString *)html {
      static dispatch_once_t onceToken;
      static NSRegularExpression *youtubeEmbedRegex;
      dispatch_once(&amp;onceToken, ^{
          youtubeEmbedRegex = [[NSRegularExpression alloc] initWithPattern:@"&lt;object.*src.*/v/(.*?)['|\"].*object\\s*&gt;" options:NSRegularExpressionCaseInsensitive error:nil];
      });
      NSArray *matchs;
      if (html != nil) {
  
          matchs = [youtubeEmbedRegex matchesInString:html options:0 range:NSMakeRange(0, html.length)];
  
      }else{
          matchs = nil;
      }
  
      NSInteger rangeOffset = 0;
      for (NSTextCheckingResult *match in matchs) {    
          NSRange objectRange = NSMakeRange([match rangeAtIndex:0].location + rangeOffset, [match rangeAtIndex:0].length);
          NSRange idRange = NSMakeRange([match rangeAtIndex:1].location + rangeOffset, [match rangeAtIndex:1].length);
          NSString* youtubrId = [html substringWithRange:idRange];
  
          // Add uniq id to img tag
          NSString* iframe = [NSString stringWithFormat:@"&lt;iframe src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\" allowfullscreen&gt;&lt;/iframe&gt;", youtubrId];
          html = [html stringByReplacingCharactersInRange:objectRange withString:iframe];
  
          rangeOffset += iframe.length - objectRange.length;
      }
  
      return html;
  }
  </code></pre>
  
  <p>And here is how I'm displaying the web view:</p>
  
  <pre><code>- (id)initWithFrame:(CGRect)frame dict:(NSDictionary *)dict {
      self = [super initWithFrame:frame];
      if (self) {
          self.webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)] autorelease];
          self.webView.backgroundColor = [UIColor clearColor];
          self.webView.opaque = NO;
          self.webView.delegate = self;
          self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
          self.webView.scalesPageToFit = NO;
          self.webView.allowsInlineMediaPlayback = YES;
          self.webView.mediaPlaybackRequiresUserAction = NO;
  
          [self removeBackgroundFromWebView:self.webView];      
          [self addSubview:self.webView];
          self.dictionary = dict;
  
      }
      return self;
  }
  </code></pre>
  
  <p>My issue is that when I start playing video - memory usage is going up to 30MB, video starts to stutter, audio/video doesn't match, and when i close it - the memory usage is still the same.</p>
  
  <p>I have a couple of leaks in AudioToolbox, also.
  I'm using iOS 6 SDK, and iOS 6.
  iOS 6 sdk broke the code - now it's not displaying anything in iOS 5.</p>