From bba13c33a097ac35ef8a29ef255be3ac47858f78 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 4 Oct 2013 18:27:32 +0200 Subject: Fix sound notification in Internet Explorer (use mp3 file for IE and other browsers which support audio/mp3 files) --- plugins/newmail_notifier/composer.json | 2 +- plugins/newmail_notifier/newmail_notifier.js | 8 +++++++- plugins/newmail_notifier/package.xml | 4 ++-- plugins/newmail_notifier/sound.mp3 | Bin 0 -> 7488 bytes 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 plugins/newmail_notifier/sound.mp3 diff --git a/plugins/newmail_notifier/composer.json b/plugins/newmail_notifier/composer.json index 9809237ba..2ca5db709 100644 --- a/plugins/newmail_notifier/composer.json +++ b/plugins/newmail_notifier/composer.json @@ -3,7 +3,7 @@ "type": "roundcube-plugin", "description": "Supports three methods of notification: 1. Basic - focus browser window and change favicon 2. Sound - play wav file 3. Desktop - display desktop notification (using webkitNotifications feature, supported by Chrome and Firefox with 'HTML5 Notifications' plugin).", "license": "GNU GPLv3+", - "version": "0.6", + "version": "0.7", "authors": [ { "name": "Aleksander Machniak", diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js index 846bc94c3..2beacf650 100644 --- a/plugins/newmail_notifier/newmail_notifier.js +++ b/plugins/newmail_notifier/newmail_notifier.js @@ -71,7 +71,13 @@ function newmail_notifier_basic() // Sound notification function newmail_notifier_sound() { - var elem, src = 'plugins/newmail_notifier/sound.wav'; + var elem, src = 'plugins/newmail_notifier/sound', + plugin = navigator.mimeTypes ? navigator.mimeTypes['audio/mp3'] : {}; + + // Internet Explorer does not support wav files, + // support in other browsers depends on enabled plugins, + // so we use wav as a fallback + src += bw.ie || (plugin && plugin.enabledPlugin) ? '.mp3' : '.wav'; // HTML5 try { diff --git a/plugins/newmail_notifier/package.xml b/plugins/newmail_notifier/package.xml index e46c9bc92..3d7277bb4 100644 --- a/plugins/newmail_notifier/package.xml +++ b/plugins/newmail_notifier/package.xml @@ -19,9 +19,9 @@ alec@alec.pl yes - 2013-09-12 + 2013-10-04 - 0.6 + 0.7 0.5 diff --git a/plugins/newmail_notifier/sound.mp3 b/plugins/newmail_notifier/sound.mp3 new file mode 100644 index 000000000..3b494a94d Binary files /dev/null and b/plugins/newmail_notifier/sound.mp3 differ -- cgit v1.2.3