Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Call function when audio play button is clicked angular

I have this audio player in my component page

<audio id="player" controls="controls" class="audiocontrol">
        <source src="{{ baseUrl }}storage/{{this.url}}" />
</audio>

and in my .ts file i automatically call the play_audio function to play the audio when page loads. This Section is working.

 play_audio()
    {  
      ​​try { 
      var player = <HTMLAudioElement> document.querySelector('#player');
      player.load();
      var promise = player.play();
      ..
      player.addEventListener("ended", (currentTime)=>{

      });
    }

but i want to call function of angular when i click on play button manually on audio control.

Any solution Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Please refer implementation from w3schools

Method 1: By using normal button click

Method 2: By using addEventListener()

I hope this solution will worked

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!