Play song when the phone is ringing

This commit is contained in:
Pierre HUBERT 2019-01-26 15:43:26 +01:00
parent 35c4597017
commit cbfe141c32
3 changed files with 17 additions and 0 deletions

BIN
assets/audio/phone_ring.mp3 Normal file

Binary file not shown.

BIN
assets/audio/phone_ring.ogg Normal file

Binary file not shown.

View File

@ -9,6 +9,13 @@
ComunicWeb.components.calls.ringScreen = {
/**
* Song object
*
* @type {SongPlayer}
*/
_song: undefined,
/**
* Notify user about an incoming call and offer him to respond it
*
@ -19,6 +26,14 @@ ComunicWeb.components.calls.ringScreen = {
*/
show: function(title, timeout, callback){
//Initialize song first
if(this._song == undefined)
this._song = new SongPlayer([
ComunicWeb.__config.assetsURL + "audio/phone_ring.mp3",
ComunicWeb.__config.assetsURL + "audio/phone_ring.ogg"
]);
this._song.playForever();
var callContainer = createElem2({
appendTo: document.body,
type: "div",
@ -58,6 +73,8 @@ ComunicWeb.components.calls.ringScreen = {
var hasResponded = false;
var respond = function(accept){
ComunicWeb.components.calls.ringScreen._song.stop();
if(hasResponded)
return;
hasResponded = true;