Add audo that plays on connect to enable autoplay

codeql
Jeremy Mahieu 5 years ago
parent 65bc4faaf2
commit 21e075bbc1
  1. BIN
      assets/audio/silence.mp3
  2. 1
      index.html
  3. 5
      js/glowingbear.js

Binary file not shown.

@ -49,6 +49,7 @@
<script type="text/javascript" src="3rdparty/favico-0.3.10.min.js"></script>
</head>
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)" ng-keyup="handleKeyRelease($event)" ng-keypress="handleKeyPress($event)" ng-class="{'no-overflow': connected}" ng-init="init()" lang="en-US">
<audio id="audioNotificationInitializer"><source src="assets/audio/silence.mp3" type="audio/mp3"></audio>
<div class="alert alert-danger upload-error" ng-show="uploadError" ng-cloak>
<p><strong>Upload error:</strong> Image upload failed.</p>
</div>

@ -78,7 +78,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$log.debug($rootScope.$$watchersCount);
};
// Detect page visibility attributes
(function() {
// Sadly, the page visibility API still has a lot of vendor prefixes
@ -721,7 +720,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
};
$scope.connect = function() {
document.getElementById('audioNotificationInitializer').play(); // Plays some silence, this will enable autoplay for notifications
notifications.requestNotificationPermission();
$rootScope.sslError = false;
$rootScope.securityError = false;
@ -730,7 +729,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.connectbutton = 'Connecting';
$scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin';
connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl, settings.useTotp, $scope.totp);
$scope.totp = "";//clear for next time
$scope.totp = ""; // Clear for next time
};
$scope.disconnect = function() {

Loading…
Cancel
Save