-
Notifications
You must be signed in to change notification settings - Fork 8
/
example.html
50 lines (43 loc) · 1.4 KB
/
example.html
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
<!doctype html>
<html>
<head>
<title>Error Plugin Example</title>
<link href="http://vjs.zencdn.net/4.0/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/4.0/video.js"></script>
<link href="videojs.errors.css" rel="stylesheet">
</head>
<body>
<video id="video" class="video-js vjs-default-skin" controls
preload="auto" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.jpg" src="http://video-js.zencoder.com/oceans-clip.mp4"
data-setup="{}">
<p>Your browser doesn't support video.
</video>
<script src="videojs.errors.js"></script>
<script>
// get a reference to the video.js player
var video = videojs('video');
// initialize the errors plugin with a custom error code and message
video.errors({
messages: {
3: 'This is an override for the generic MEDIA_ERR_DECODE',
'custom': 'This is a custom error message'
}
});
// we're going to trigger an error manually for demonstration purposes...
video.trigger({
type:'error',
// this error code would simulate a network error
// code: 2,
// this error code would display our MEDIA_ERR_DECODE override message
// code: 3,
// if the error code doesn't have an associated message, the 'unknown'
// message is displayed
// code: 'unknown',
// You can also specify a custom message like this one when you initialize
// the plugin
code: 'custom',
target: video.el()
});
</script>
</body>
</html>