-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ES6: Migrate "audio" with proper logging (#925)
- Loading branch information
Showing
13 changed files
with
434 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2016 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
window.z = window.z || {}; | ||
window.z.audio = z.audio || {}; | ||
|
||
window.z.audio.AudioError = class AudioError extends Error { | ||
constructor(type) { | ||
super(); | ||
this.name = this.constructor.name; | ||
this.stack = (new Error()).stack; | ||
this.type = type || z.audio.AudioError.TYPE.UNKNOWN; | ||
switch (this.type) { | ||
case z.audio.AudioError.TYPE.ALREADY_PLAYING: | ||
this.message = 'Sound is already playing'; | ||
break; | ||
case z.audio.AudioError.TYPE.FAILED_TO_PLAY: | ||
this.message = 'Failed to play sound'; | ||
break; | ||
case z.audio.AudioError.TYPE.IGNORED_SOUND: | ||
this.message = 'Ignored request to play sound'; | ||
break; | ||
case z.audio.AudioError.TYPE.NOT_FOUND: | ||
this.message = 'AudioElement or ID not found'; | ||
break; | ||
default: | ||
this.message = 'Unknown AudioError'; | ||
} | ||
} | ||
|
||
static get TYPE() { | ||
return { | ||
ALREADY_PLAYING: 'z.audio.AudioError.TYPE.ALREADY_PLAYING', | ||
FAILED_TO_PLAY: 'z.audio.AudioError.TYPE.FAILED_TO_PLAY', | ||
IGNORED_SOUND: 'z.audio.AudioError.TYPE.IGNORED_SOUND', | ||
NOT_FOUND: 'z.audio.AudioError.TYPE.NOT_FOUND', | ||
UNKNOWN: 'z.audio.AudioError.TYPE.UNKNOWN', | ||
}; | ||
} | ||
}; | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2016 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
window.z = window.z || {}; | ||
window.z.audio = z.audio || {}; | ||
|
||
z.audio.AudioPlayingType = { | ||
NONE: [ | ||
z.audio.AudioType.CALL_DROP, | ||
z.audio.AudioType.NETWORK_INTERRUPTION, | ||
z.audio.AudioType.OUTGOING_CALL, | ||
z.audio.AudioType.READY_TO_TALK, | ||
z.audio.AudioType.TALK_LATER, | ||
], | ||
SOME: [ | ||
z.audio.AudioType.CALL_DROP, | ||
z.audio.AudioType.INCOMING_CALL, | ||
z.audio.AudioType.INCOMING_PING, | ||
z.audio.AudioType.NETWORK_INTERRUPTION, | ||
z.audio.AudioType.OUTGOING_CALL, | ||
z.audio.AudioType.OUTGOING_PING, | ||
z.audio.AudioType.READY_TO_TALK, | ||
z.audio.AudioType.TALK_LATER, | ||
], | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2016 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
window.z = window.z || {}; | ||
window.z.audio = z.audio || {}; | ||
|
||
z.audio.AudioPreference = { | ||
ALL: 'all', | ||
NONE: 'none', | ||
SOME: 'some', | ||
}; |
Oops, something went wrong.