- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML5 check if audio is playing
Use the following to check if audio is playing −
functionisPlaying(audelem) { return!audelem.paused; }
The above code can be used to check ifaudio is playing or not. The audio tag has a paused property.The paused property returns whether the audio/video is paused.
You can also toggle −
functiontogglePause() { if(newAudio.paused && newAudio.currentTime > 0 && !newAudio.ended) { newAudio.play(); } else { newAudio.pause(); } }
- Related Articles
- HTML5 audio not playing in PhoneGap App
- HTML5 Audio to Play Randomly
- HTML5 audio control stop button
- How to keep audio playing while navigating through pages?
- Is it possible to style HTML5 audio tag?
- How to play HTML5 Audio Randomly
- HTML5 video not playing in Firefox
- How to detect HTML5 audio MP3 support
- Playing MP4 video in WebView using HTML5 in Android
- How do we embed audio in web pages in HTML5?
- How to change the playing speed of videos in HTML5?
- How to prevent the HTML5 video from loading before playing?
- How do we specify that the audio/video will start playing as soon as it is ready in HTML?
- What is Audio Steganography?
- Create a media resources for media elements, defined inside video or audio elements in HTML5.

Advertisements