Advertisement
jskoepm

mp3Online

Jun 18th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> PKP mp3 online</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. </head>
  7. <body>
  8. <audio controls id="MyMp3">
  9. <source id="urlstream" src="" type="audio/mpeg">
  10. Your browser does not support the audio element.
  11. </audio>
  12. <br />
  13. Nhap ma:
  14. <br />
  15. <input id="inputURL" type="text" value="">
  16. <button onclick="myFunction()">Xac nhan</button>
  17. <br />
  18. <button onclick="playVid()" type="button">Play</button>
  19. <button onclick="pauseVid()" type="button">Pause</button><br>
  20.  
  21.  
  22. <br />Số lần đã check: <span id="checkPAUSE1"></span>
  23. <br />Số lần load lại: <span id="checkPAUSE2"></span>
  24.  
  25. <script language="JavaScript">
  26. var vid = document.getElementById("MyMp3");
  27. function myFunction()
  28. {
  29. document.getElementById("urlstream").src = atob(document.getElementById("inputURL").value);
  30. vid.load(); vid.play();
  31. }
  32. function playVid() { vid.play(); }
  33. function pauseVid() { vid.pause(); }
  34.  
  35. var numPAUSE = 0;
  36. var i = 0;
  37. setInterval(function()
  38. {
  39. if (vid.currentTime == 0 && !vid.duration || vid.currentTime == vid.duration)
  40. {
  41. vid.load();
  42. vid.play();
  43. numPAUSE++;
  44. document.getElementById("checkPAUSE2").innerHTML = numPAUSE;
  45. }
  46. document.getElementById("checkPAUSE1").innerHTML = i + "_" + vid.currentTime + "_" + vid.duration;
  47. i++;
  48. }, 4000);
  49. </script>
  50.  
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement