I'm working on an Electron app
with Angular 4. I want to play sound on some specific action. Is there any module or code for that? It can be in the angular 4 or if electron is providing some service for that it should also work
As I want to play it on some action I can't use the HTML audio tag and audio() of javascript
I only want to play the sound of 2-3 seconds so no other functionalities are needed.
It can be of electron or Angular 4 any of them can work...
An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin. A library for playing audio using HTML 5 audio for Angular 7/8/9.
audioObject.progress: The progress of the object as a percentage (0-1); Angular audio is designed to be powerful and awesome, so use it everywhere, even in projects where you hadn't even considered using sound in the first place. Its directives make sound a breeze.
A fast and angular way of handling audio. ngAudio is a lightweight package of directives and services that treat sound in an angular way. Adjust volume and time with getters and setters. Attach easily to the scope. Preloads sounds automatically.
In a typical Angular application, you might use some state management library like NgRx. But in this application, you are going to use BehaviorSubject to manage the state of the application. You are going to update AudioService to manage the state since the state is dependent on audio playback.
just did this in a project am working (angular 4) and it worked
playAudio(){ let audio = new Audio(); audio.src = "../../../assets/audio/alarm.wav"; audio.load(); audio.play(); } this.playAudio();
make sure the path is correct and references an existing audio
As per Robin's comment, i have checked that link we can use it using the audio() object in the ts file like this:
this.audio = new Audio(); this.audio.src = "../../../assets/sounds/button_1.mp3"; this.audio.load(); this.audio.play();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With