Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can stop youtube video sound after close inappbrowser

How can stop youtube video sound after closing webview opened by inappbrowser(Android Phonegap 2.4.0 plugin)

I used two week to fix that problem and tired out..............

When I click 'Done' button to close webview(youtube page), the video still play in the background.

Even after shutting down app, can't stop video sound. To stop video I had to turn off phone.

This is my code

<script type="text/javascript" charset="utf-8">

 function OpenWin(juso) {
        window.open(juso, '_blank', 'location=yes');
         }

</script>  


<body>
...................
<a href="#" onclick="OpenWin('http://m.youtube.com')"> 
...................
</body>

Is there any wrong in my code? May I get some help?

like image 995
user2096812 Avatar asked Nov 13 '22 10:11

user2096812


1 Answers

I am using Sencha Touch and using the following trick to stop the Youtube Video sound. You may take it as reference.

var ref = window.open(url,'_blank',options);
ref.addEventListener('exit',function(){
    Ext.defer(function(){
        ref.removeEventListener('exit',function(){
            console.log('Closed');
        });
        var ref2 = window.open('about:blank','_blank','hidden=yes');
        Ext.defer(function(){
            ref2.close();
        },350);
    },350);
});
like image 138
user5680573 Avatar answered Jan 04 '23 02:01

user5680573