Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: call hangup sound improved [WTEL-5123] #775

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^11.0.3",
"@webitel/flow-ui-sdk": "^0.1.14",
"@webitel/ui-sdk": "^24.10.10",
"@webitel/ui-sdk": "^24.10.11",
"axios": "^1.7.7",
"clipboard-copy": "^4.0.1",
"cron-validator": "^1.3.1",
Expand Down
26 changes: 3 additions & 23 deletions src/modules/settings/components/ringtone-volume-control.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@

<script>
import debounce from '@webitel/ui-sdk/src/scripts/debounce';
import triggerSound from '@webitel/ui-sdk/src/modules/Notifications/assets/audio/triggerSound';

export default {
data() {
return {
ringtoneVolume: 0.5, // Default ringtoneVolume level
ringtoneVolume: 1, // Default ringtoneVolume level
isRingtoneVolumeSaved: false,
audioCtx: null, // Audio context will be created upon user interaction
};
},
methods: {
Expand All @@ -57,29 +57,9 @@ export default {
localStorage.setItem('settings/ringtone-volume', this.ringtoneVolume);
this.isRingtoneVolumeSaved = true;
},
playSignal(ringtoneVolume) {
// Initialize the AudioContext if it hasn't been created yet
if (!this.audioCtx) {
this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
}

const oscillator = this.audioCtx.createOscillator();

oscillator.frequency.setValueAtTime(440, this.audioCtx.currentTime); // Standard A4 note

const gainNode = this.audioCtx.createGain();
gainNode.gain.value = ringtoneVolume; // Set the ringtoneVolume based on the selected value

oscillator.connect(gainNode);
gainNode.connect(this.audioCtx.destination);

oscillator.start();

oscillator.stop(this.audioCtx.currentTime + 0.2);
},
// Use your custom debounce method
debouncedPlayBeep: debounce(function (volume) {
this.playSignal(volume);
triggerSound(volume);
}, {}, 300), // Debounce options and 300ms wait time
},
mounted() {
Expand Down
Loading