tips:cordova:inappbrowser

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tips:cordova:inappbrowser [2015/02/25 07:34] – created scipiotips:cordova:inappbrowser [2015/03/27 17:40] (current) – [autoplay] scipio
Line 5: Line 5:
 With these modifications the hardware back button works within pages in an InAppBrowser. With these modifications the hardware back button works within pages in an InAppBrowser.
  
-src/com/org/apache/corodova/inappbrowser/**InAppBrowser.java** +In src/com/org/apache/corodova/inappbrowser/**InAppBrowser.java** change
- +
-change+
 <code java> <code java>
 private void goBack() { private void goBack() {
Line 16: Line 14:
 </code> </code>
  
-to (note public method)+to (public method)
 <code java> <code java>
 public void goBack() { public void goBack() {
Line 59: Line 57:
 </code> </code>
  
 +===== autoplay =====
 +
 +Enable video autplay without gestures
 +
 +In file src/com/org/apache/corodova/inappbrowser/**InAppBrowser.java** add (~647 row)
 +<code java>
 +  inAppWebView.loadUrl(url);
 +  inAppWebView.setId(6);
 +  inAppWebView.getSettings().setLoadWithOverviewMode(true);
 +  inAppWebView.getSettings().setUseWideViewPort(true);
 ++ inAppWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
 +</code>
 +
 +===== loop =====
 +
 +Looping mode does not work, add this hack to javascript and add looping="loop" attribute to video tag
 +<code javascript>
 +    var videos = jQNew( "video[looping='loop']" );
 +    for (index = 0; index < videos.length; ++index) {
 +       videos[index].addEventListener('ended', function (e) {window.location.reload();},false);
 +    }
 +</code>
  • tips/cordova/inappbrowser.1424846044.txt.gz
  • Last modified: 2015/02/25 07:34
  • by scipio