forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideo.js
More file actions
69 lines (53 loc) · 1.84 KB
/
Video.js
File metadata and controls
69 lines (53 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var Video = {
// @property {boolean} oggVideo - Can this device play ogg video files?
oggVideo: false,
// @property {boolean} h264Video - Can this device play h264 mp4 video files?
h264Video: false,
// @property {boolean} mp4Video - Can this device play h264 mp4 video files?
mp4Video: false,
// @property {boolean} webmVideo - Can this device play webm video files?
webmVideo: false,
// @property {boolean} vp9Video - Can this device play vp9 video files?
vp9Video: false,
// @property {boolean} hlsVideo - Can this device play hls video files?
hlsVideo: false
};
function init ()
{
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;
}
module.exports = init();