forked from videojs/video.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponsive.html.example
More file actions
160 lines (138 loc) · 4.05 KB
/
responsive.html.example
File metadata and controls
160 lines (138 loc) · 4.05 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Video.js Sandbox - Responsive</title>
<link href="../dist/video-js.css" rel="stylesheet" type="text/css">
<script src="../dist/video.js"></script>
<style type="text/css">
body {
margin: 0;
padding: 0;
}
.breakpoints, .video-js, table {
margin: 1em 0;
}
table {
border-collapse: collapse;
}
th, td {
border: 1px solid #ccc;
padding: 0.5em 1em;
}
tbody tr {
color: #999;
}
tbody tr:first-child {
color: #000;
}
.breakpoints div {
background-color: red;
color: white;
padding: 0.5em 1em;
}
@media (max-width: 210px) {
.breakpoints .tiny {
background-color: green;
}
}
@media (min-width: 211px) and (max-width: 320px) {
.breakpoints .x-small {
background-color: green;
}
}
@media (min-width: 321px) and (max-width: 425px) {
.breakpoints .small {
background-color: green;
}
}
@media (min-width: 426px) and (max-width: 768px) {
.breakpoints .medium {
background-color: green;
}
}
@media (min-width: 769px) and (max-width: 1440px) {
.breakpoints .large {
background-color: green;
}
}
@media (min-width: 1441px) and (max-width: 2560px) {
.breakpoints .x-large {
background-color: green;
}
}
@media (min-width: 2561px) {
.breakpoints .huge {
background-color: green;
}
}
</style>
</head>
<body>
<p>
The following boxes indicate which breakpoint should be applied to the
player when it fills the width of its containing viewport.
</p>
<p>
Use these to validate that the default breakpoints match up with how
CSS media queries work.
</p>
<p>
<b>Because these bars are updated by CSS, they will change before the <code>playerresize</code> event occurs!</b>
</p>
<div class="breakpoints">
<div class="tiny">vjs-layout-tiny (0px-210px)</div>
<div class="x-small">vjs-layout-x-small (211px-320px)</div>
<div class="small">vjs-layout-small (321px-425px)</div>
<div class="medium">vjs-layout-medium (426px-768px)</div>
<div class="large">vjs-layout-large (769px-1440px)</div>
<div class="x-large">vjs-layout-x-large (1441px-2560px)</div>
<div class="huge">vjs-layout-huge (2561px+)</div>
</div>
<video-js
class="vjs-fluid"
controls
preload="auto"
poster="http://vjs.zencdn.net/v/oceans.png">
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
<source src="http://vjs.zencdn.net/v/oceans.ogv" type="video/ogg">
<track kind="captions" src="../docs/examples/shared/example-captions.vtt" srclang="en" label="English">
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
</video-js>
<p>
Each time the player size changes, a row is prepended to this table.
</p>
<table>
<thead>
<tr>
<th>Class</th>
<th>Player Width</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
var vid = document.querySelector('video-js');
var player = videojs(vid, {responsive: true});
var tbody = document.querySelector('table tbody');
player.on('playerresize', function() {
var values = {
breakpoint: player.currentBreakpoint(),
className: player.el().className.match(/vjs-layout-([a-z\-]+)/)[0],
playerWidth: player.currentWidth()
};
videojs.log('playerresize', values);
var tr = document.createElement('tr');
tr.innerHTML = '<td>' +
values.className +
'</td><td>' +
values.playerWidth +
'</td>';
tbody.insertBefore(tr, tbody.firstChild);
});
</script>
</body>
</html>