mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Play song when the phone is ringing
This commit is contained in:
parent
35c4597017
commit
cbfe141c32
BIN
assets/audio/phone_ring.mp3
Normal file
BIN
assets/audio/phone_ring.mp3
Normal file
Binary file not shown.
BIN
assets/audio/phone_ring.ogg
Normal file
BIN
assets/audio/phone_ring.ogg
Normal file
Binary file not shown.
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user