Friday 15 May 2015

Autoplay media files in UIWebView in IOS

When displaying media content using HTML5 in a web view on IOS the autoplay functionality does not work.
To enable to web view to autoplay the media (if coded in HTML to autoplay) you need to add a line of code in your IOS application as explained.
Let's say you have a webview object declared as in line below.
  1. UIWebView *videoView;
Then you need to add the code after initializing the webview as below.
  1. videoView.mediaPlaybackRequiresUserAction = NO;
  2. videoView.allowsInlineMediaPlayback = YES
This forces the video/audio to autoplay in UIWebView if directed in HTML code.

For such more Blogs you can visit to http://findnerd.com/NerdDigest

No comments:

Post a Comment