2016-11-26 01:28:53 +00:00
|
|
|
|
2016-11-25 04:33:48 +00:00
|
|
|
var Video = {
|
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// @property {boolean} oggVideo - Can this device play ogg video files?
|
2016-11-25 04:33:48 +00:00
|
|
|
oggVideo: false,
|
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// @property {boolean} h264Video - Can this device play h264 mp4 video files?
|
2016-11-25 04:33:48 +00:00
|
|
|
h264Video: false,
|
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// @property {boolean} mp4Video - Can this device play h264 mp4 video files?
|
2016-11-25 04:33:48 +00:00
|
|
|
mp4Video: false,
|
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// @property {boolean} webmVideo - Can this device play webm video files?
|
2016-11-25 04:33:48 +00:00
|
|
|
webmVideo: false,
|
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// @property {boolean} vp9Video - Can this device play vp9 video files?
|
2016-11-25 04:33:48 +00:00
|
|
|
vp9Video: false,
|
|
|
|
|
2017-08-01 12:10:08 +00:00
|
|
|
// @property {boolean} hlsVideo - Can this device play hls video files?
|
2016-11-25 04:33:48 +00:00
|
|
|
hlsVideo: false
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-11-26 01:28:53 +00:00
|
|
|
function init ()
|
2016-11-25 04:33:48 +00:00
|
|
|
{
|
|
|
|
var videoElement = document.createElement('video');
|
|
|
|
var result = !!videoElement.canPlayType;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (result)
|
|
|
|
{
|
|
|
|
if (videoElement.canPlayType('video/ogg; codecs="theora"').replace(/^no$/, ''))
|
|
|
|
{
|
|
|
|
Video.oggVideo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (videoElement.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/, ''))
|
|
|
|
{
|
|
|
|
// Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546
|
|
|
|
Video.h264Video = true;
|
|
|
|
Video.mp4Video = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (videoElement.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/, ''))
|
|
|
|
{
|
|
|
|
Video.webmVideo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (videoElement.canPlayType('video/webm; codecs="vp9"').replace(/^no$/, ''))
|
|
|
|
{
|
|
|
|
Video.vp9Video = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (videoElement.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/, ''))
|
|
|
|
{
|
|
|
|
Video.hlsVideo = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
// Nothing to do
|
|
|
|
}
|
|
|
|
|
|
|
|
return Video;
|
|
|
|
}
|
|
|
|
|
2016-11-26 01:28:53 +00:00
|
|
|
module.exports = init();
|