Skip to content

Javascript to detect if browser supports HTML5 video mp4,ogg,webm playback or not

License

Notifications You must be signed in to change notification settings

flouthoc/isVideo.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

isVideo.js

Javascript to detect if browser supports HTML5 video mp4,ogg,webm playback or not.

#Usage Getting Started

<script type="text/javascript" src="https://raw.githubusercontent.com/argunner/isVideo.js/master/index.js"></script>

####Regular

if(isVideo(format)){
  ....browser supports this code....
  }else{
  .....Some code if browser does not support video playback ...
  }

####Formats

  
  MPEG-4  isVideo("mp4")
  OGG     isVideo("ogg")
  WebM    isVideo("webm")

###Example

  
  window.onload = function(){
    if(isVideo("mp4")){
      document.getElementById('video').innerHTML = "<video width='320 height='240' controls><source src='f.mp4' type='video/mp4'></video>";
	  }else{
	    ... do nothing ..
	  }
	}

About

Javascript to detect if browser supports HTML5 video mp4,ogg,webm playback or not

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published