This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tips:cordova [2015/02/16 14:37] – [Crosswalk] scipio | tips:cordova [2015/02/19 17:10] (current) – [Cordova] scipio | ||
|---|---|---|---|
| Line 144: | Line 144: | ||
| ===== Video autoplay ===== | ===== Video autoplay ===== | ||
| + | |||
| + | Con ionic-crosswalk i video partono da soli con il set di src via javascript | ||
| + | <code javascript> | ||
| + | if (! $('# | ||
| + | $('# | ||
| + | } | ||
| + | $("# | ||
| + | $("# | ||
| + | </ | ||
| + | |||
| + | ==== Cordova ==== | ||
| CordovaApp.java | CordovaApp.java | ||
| Line 149: | Line 160: | ||
| super.init(); | super.init(); | ||
| super.appView.getSettings().setMediaPlaybackRequiresUserGesture(false); | super.appView.getSettings().setMediaPlaybackRequiresUserGesture(false); | ||
| + | </ | ||
| + | |||
| + | ==== Cordova Crosswalk ==== | ||
| + | |||
| + | < | ||
| + | ... | ||
| + | super.init(); | ||
| + | getSettings(super.appView).setMediaPlaybackRequiresUserGesture(false); | ||
| + | ... | ||
| + | |||
| + | /* rende plubblica la API mascherata dalle nuove release di crosswalk */ | ||
| + | private XWalkSettings getSettings(XWalkView webView) | ||
| + | { | ||
| + | try | ||
| + | { | ||
| + | Method ___getBridge = XWalkView.class.getDeclaredMethod(" | ||
| + | ___getBridge.setAccessible(true); | ||
| + | XWalkViewBridge xWalkViewBridge = null; | ||
| + | xWalkViewBridge = (XWalkViewBridge)___getBridge.invoke(webView); | ||
| + | XWalkSettings xWalkSettings = xWalkViewBridge.getSettings(); | ||
| + | return xWalkSettings; | ||
| + | } | ||
| + | catch (Exception e) | ||
| + | { | ||
| + | e.printStackTrace(); | ||
| + | } | ||
| + | return null; | ||
| + | } | ||
| </ | </ | ||