forked from videojs/videojs-playlist-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-custom-element.html
137 lines (126 loc) · 4.23 KB
/
example-custom-element.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
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Video.js Playlist UI - Using a Custom Element</title>
<link href="node_modules/video.js/dist/video-js.css" rel="stylesheet">
<link href="dist/videojs-playlist-ui.css" rel="stylesheet">
<style>
body {
font-family: Arial, sans-serif;
}
.info {
background-color: #eee;
border: thin solid #333;
border-radius: 3px;
margin: 0 0 20px;
padding: 0 5px;
}
/*
We include some minimal custom CSS to make the playlist UI look good
in this context.
*/
.player-container {
background: #1a1a1a;
overflow: auto;
width: 934px;
}
.video-js {
float: left;
}
#my-custom-element {
float: left;
width: 300px;
}
</style>
</head>
<body>
<div class="info">
<h1>Video.js Playlist UI - Using a Custom Element</h1>
<p>
You can see the Video.js Playlist UI plugin in action below. Look at the
source of this page to see how to use it with your videos.
</p>
<p>
When using a custom element, the plugin uses the element that it was
given as a container for the list.
</p>
<p>
<strong>Using this option means the default styles MAY NOT apply (it
depends on whether the element has the "vjs-playlist" class) so, you
might have to define your own.</strong> This may be desirable or not -
depending on your implementation. This example has been left un-styled
to demonstrate this fact.
</p>
</div>
<div class="player-container">
<video
id="video"
class="video-js"
height="300"
width="600"
controls>
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4">
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm">
</video>
<div id="my-custom-element">
<!--
The contents of this element will be filled based on the
currently loaded playlist
-->
</div>
</div>
<script src="node_modules/video.js/dist/video.js"></script>
<script src="node_modules/videojs-playlist/dist/videojs-playlist.js"></script>
<script src="dist/videojs-playlist-ui.js"></script>
<script>
var player = videojs('video');
player.playlist([{
name: 'Disney\'s Oceans',
description: 'Explore the depths of our planet\'s oceans. ' +
'Experience the stories that connect their world to ours. ' +
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, ' +
'sed do eiusmod tempor incididunt ut labore et dolore magna ' +
'aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco ' +
'laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure ' +
'dolor in reprehenderit in voluptate velit esse cillum dolore eu ' +
'fugiat nulla pariatur. Excepteur sint occaecat cupidatat non ' +
'proident, sunt in culpa qui officia deserunt mollit anim id est ' +
'laborum.',
duration: 45,
sources: [
{ src: 'http://vjs.zencdn.net/v/oceans.mp4', type: 'video/mp4' },
{ src: 'http://vjs.zencdn.net/v/oceans.webm', type: 'video/webm' },
],
// you can use <picture> syntax to display responsive images
thumbnail: [
{
srcset: 'test/example/oceans.jpg',
type: 'image/jpeg',
media: '(min-width: 400px;)'
},
{
src: 'test/example/oceans-low.jpg'
}
]
}, {
name: 'Sintel',
description: 'The film follows a girl named Sintel who is searching for a baby dragon she calls Scales.',
sources: [
{ src: 'http://media.w3.org/2010/05/sintel/trailer.mp4', type: 'video/mp4' },
{ src: 'http://media.w3.org/2010/05/sintel/trailer.webm', type: 'video/webm' },
{ src: 'http://media.w3.org/2010/05/sintel/trailer.ogv', type: 'video/ogg' }
],
thumbnail: false
},
// This is a really underspecified video to demonstrate the
// behavior when optional parameters are missing. You'll get prettier
// results with more video metadata!
{
sources: []
}]);
// Initialize the playlist-ui plugin with an element.
player.playlistUi(document.getElementById('my-custom-element'));
</script>
</body>
</html>