Note that there are some explanatory texts on larger screens.

plurals
  1. POYouTube video in an iframe continues to play after navigation - Android and Phonegap
    primarykey
    data
    text
    <p>The question is similar to <a href="https://stackoverflow.com/questions/13757186/youtube-video-in-an-iframe-in-webview-continues-to-play-after-navigation">YouTube video in an iframe in Webview continues to play after navigation</a> asked on windows 8</p> <p>I am creating an android app using Phonegap. I was able to show a Youtube video using Childbrowser plugin and with the help Youtube iframe code which is present inside a php file on my server. </p> <p>However if a user hits the back button, the application screen is displayed and you can hear the sound of the video. </p> <p>The code to invoke childbrowser is as follows:</p> <pre><code> $('#videobutton').attr('onclick', 'javascript:window.plugins.childBrowser.showWebPage("http://example.com/sundeep/video.php?trailer='+trailer+'", { showLocationBar: false });'); </code></pre> <p>I know to close childbrowser you need to place the following code:</p> <pre><code>window.plugins.childBrowser.onClose(); </code></pre> <p>But I don't know where to place the above code.</p> <p><strong>Workaround</strong> I even tried a workaround by using childbrowser to open a local page(video.html) that contains the iframe code as follows:</p> <pre><code> $('#videobutton').attr('onclick', 'javascript:window.plugins.childBrowser.showWebPage("file:///android_asset/www/video.html", { showLocationBar: false });'); </code></pre> <p>and using window.localStorage.setItem I was able to pass and display the video. I have the below code that should theoretically solve the original problem but does not work:</p> <pre><code> &lt;script type="text/javascript" charset="utf-8"&gt; // Call onDeviceReady when Cordova is loaded. // // At this point, the document has loaded but cordova-2.3.0.js has not. // When Cordova is loaded and talking with the native device, // it will call the event `deviceready`. // function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } // Cordova is loaded and it is now safe to call Cordova methods // function onDeviceReady() { // Register the event listener document.addEventListener("backbutton", onBackKeyDown, false); } // Handle the back button // function onBackKeyDown() { window.plugins.childBrowser.onClose(); } &lt;/script&gt; </code></pre> <ul> <li>Apache Cordova (Phonegap) - 2.3.0 Jquery Mobile - 1.2 Android - Jelly bean (4.2)</li> </ul> <p>Any help is appreciated!! Really stuck on this one.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload