title: Video in UIView (or UIWebView)
body: <p>I would like to know if I can play a video in <code>UIView</code>?</p>
  
  <p>I want to play a video in a small <code>UIView</code> (say 100 x 100 ) which should be played automatically when the <code>UIView</code> loads.</p>
  
  <p>First I would say what I tried out ... It would be really helpful if the experts ( I am a 2 week old baby in IOS development &amp; Obj- C) to confirm whether the route I am heading is right..</p>
  
  <p>I created a UIWebView and and tried to embed a video in it using HTML video tag (html5)
  For the <code>UIWebview</code> I set the <code>allowInlineMediaPlayback</code> to YES and <code>mediaPlaybackRequiresUserAction</code> to NO ... Also in the HTML code, for the video tag, I used - webkit-playsinline.</p>
  
  <p>Any help is much appreciated.</p>
  
  <p><strong>Update</strong></p>
  
  <p>This is my code with my html block ... I did add the play video JS .... But when I run the app in simulator , I do not get the video , only get audio.</p>
  
  <pre><code> NSString *embedHTML = @"\
       &lt;!DOCTYPE HTML&gt;\
       &lt;html&gt;\
       &lt;head&gt;\
       &lt;script type=\"text/javascript\"&gt;\
       function playvideo() {\
           var myVideo=document.getElementsByTagName('video')[0];\
           myVideo.play();\
           myVideo.webkitExitFullscreen();\
           myVideo.height = 120;\
           myVideo.width  = 120;\
       }\
       &lt;/script&gt;\
       &lt;/head&gt;\
       &lt;body onLoad = \"playvideo()\" &gt;\
       &lt;video id=\"player\" webkit-playsinline width=\"140\" height=\"140\"&gt;\
       &lt;source src=\"file:///Users/Shilpa/Desktop/Movie Player/MoviePlayer-ios4-Next/Movie-1.mp4\"/&gt;\
       &lt;/video&gt;\
       &lt;/body&gt;\
       &lt;/html&gt;";
  
       webView = [[UIWebView alloc] initWithFrame:CGRectMake(100.0, 170.0, 150.0, 150.0)];
       [webView setOpaque:YES];
  
       NSString *html = [NSString stringWithFormat:embedHTML, webView.frame.size.width, webView.frame.size.height];
       [webView loadHTMLString:html baseURL:nil];
       webView.allowsInlineMediaPlayback = YES;
       webView.mediaPlaybackRequiresUserAction = NO;
  
       webView.transform = CGAffineTransformMakeRotation(3.14/2);
  
       [moviePlayerWindow addSubview:webView];
  </code></pre>