Pause audio, videos and iframe

This commit is contained in:
Jeremy Mahieu 2020-07-22 23:12:09 +02:00
parent 3858c0ff0c
commit 2685219376
1 changed files with 18 additions and 0 deletions

View File

@ -31,6 +31,24 @@ weechat.directive('plugin', ['$rootScope', 'settings', function($rootScope, sett
$scope.hideContent = function() {
$scope.plugin.visible = false;
// Pause noise makers
var element = $scope.plugin.getElement()
// If it's video we can pause it
var video = element.querySelector( 'video' );
if ( video ) {
video.pause();
}
// If it's audio we can pause it
var audio = element.querySelector( 'audio' );
if ( audio ) {
audio.pause();
}
// If it has an iframe, have to reload it so it would stop
var iframe = element.querySelector( 'iframe');
if ( iframe ) {
var innerHTML = element.innerHTML;
element.innerHTML = innerHTML;
}
};
$scope.showContent = function(automated) {