Advertisement
RyukiChan

Untitled

May 26th, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <audio autoplay id="myAudio" src="./takbiran.mp3" preload="auto">
  2. </audio>
  3.  
  4. <script>
  5. var myAudio = document.getElementById("myAudio");
  6. var isPlaying = false;
  7.  
  8. function togglePlay() {
  9. if (isPlaying) {
  10. myAudio.pause()
  11. } else {
  12. myAudio.play();
  13. }
  14. };
  15.  
  16. myAudio.onplaying = function() {
  17. isPlaying = true;
  18. };
  19.  
  20. myAudio.onpause = function() {
  21. isPlaying = false;
  22. };
  23. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement