diff --git a/mod/chat/beep.mp3 b/mod/chat/beep.mp3 new file mode 100644 index 00000000000..6cfa71d1ad7 Binary files /dev/null and b/mod/chat/beep.mp3 differ diff --git a/mod/chat/beep.wav b/mod/chat/beep.wav deleted file mode 100644 index fb48e2bd0fc..00000000000 Binary files a/mod/chat/beep.wav and /dev/null differ diff --git a/mod/chat/chatd.php b/mod/chat/chatd.php index 23fbeac146e..7213186bd35 100644 --- a/mod/chat/chatd.php +++ b/mod/chat/chatd.php @@ -104,7 +104,7 @@ class ChatDaemon { $this->_trace_level = E_ALL ^ E_USER_NOTICE; $this->_pcntl_exists = function_exists('pcntl_fork'); $this->_time_rest_socket = 20; - $this->_beepsoundsrc = $GLOBALS['CFG']->wwwroot.'/mod/chat/beep.wav'; + $this->_beepsoundsrc = $GLOBALS['CFG']->wwwroot.'/mod/chat/beep.mp3'; $this->_freq_update_records = 20; $this->_freq_poll_idle_chat = $GLOBALS['CFG']->chat_old_ping; $this->_stdout = fopen('php://stdout', 'w'); @@ -754,8 +754,11 @@ EOD; $this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL]); if ($output->beep) { + $playscript = '(function() { var audioElement = document.createElement("audio");' . "\n"; + $playscript .= 'audioElement.setAttribute("src", "'.$this->_beepsoundsrc.'");' . "\n"; + $playscript .= 'audioElement.play(); })();' . "\n"; $this->write_data($this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL], - ''); + ''); } if ($info['quirks'] & QUIRK_CHUNK_UPDATE) { diff --git a/mod/chat/gui_ajax/module.js b/mod/chat/gui_ajax/module.js index 7f4b07e710c..758df345e99 100644 --- a/mod/chat/gui_ajax/module.js +++ b/mod/chat/gui_ajax/module.js @@ -133,7 +133,9 @@ M.mod_chat_ajax.init = function(Y, cfg) { item.addClass((message.mymessage) ? 'mdl-chat-my-entry' : 'mdl-chat-entry'); Y.one('#messages-list').append(item); if (message.type && message.type == 'beep') { - Y.one('#chat-notify').setContent(''); + var audioElement = document.createElement('audio'); + audioElement.setAttribute('src', '../beep.mp3'); + audioElement.play(); } }, diff --git a/mod/chat/gui_header_js/jsupdate.php b/mod/chat/gui_header_js/jsupdate.php index a7e38f3c3c6..726a14b2b7c 100644 --- a/mod/chat/gui_header_js/jsupdate.php +++ b/mod/chat/gui_header_js/jsupdate.php @@ -173,7 +173,11 @@ if ($refreshusers) {
'; + echo ''; } ?> Refresh link diff --git a/mod/chat/gui_header_js/jsupdated.php b/mod/chat/gui_header_js/jsupdated.php index c30de52b2f0..3e564c673c9 100644 --- a/mod/chat/gui_header_js/jsupdated.php +++ b/mod/chat/gui_header_js/jsupdated.php @@ -223,7 +223,11 @@ EOD; print "//]]>\n"; print '' . "\n\n"; if ($beep) { - print ''; + print ''; } print $CHAT_DUMMY_DATA; sleep($CFG->chat_refresh_room);