BrU32

JS HTML 5 Check Video/Audio Network State & Set Cross Orgin

Sep 6th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4. <button onclick="getVidNetworkState();" type="button">Get The Network State Of The Current Video/Audio File </button><br>
  5.  
  6. <video id="video" width="325" height="325" controls>
  7. <source src="mov_bbb.mp4" type="video/mp4">
  8. </video>
  9.  
  10. <script>
  11. var vid = document.getElementById("video");
  12. vid.src= prompt('Enter Video URL:');
  13. function getVidNetworkState(str) {
  14. vid.crossOrign=true;
  15. if(vid.networkState==3){
  16. alert('No Video Found!!');
  17. }
  18. if(vid.networkState==1){
  19. alert('Video Was Found!!');
  20. }
  21. }
  22. </script>
  23.  
  24. </html>
Advertisement
Add Comment
Please, Sign In to add comment