-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.html
174 lines (148 loc) · 4.73 KB
/
index.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Example | React Drive-In</title>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css" />
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Raleway:400,300,600" />
<link href="http://fonts.googleapis.com/css?family=Mouse+Memoirs" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="react-drive-in.css">
<style>
html, body {
height: 100%;
}
h2 {
color: #fff;
}
.row {
padding: 50px 0;
}
button {
background-color:#000;
border: 1px solid #000;
color: #ccc;
border-radius: 5px;
padding: 10px;
}
button:hover {
color: #fff;
}
button:focus {
color: #fff;
outline: 0;
}
.buttons {
padding: .2em;
}
</style>
</head>
<body>
<div id="drive-in"></div>
<div class="section hero">
<div class="container">
<div class="row">
<div class="mode-select buttons">
<button onClick="example.modeSelect('video');">Videos</button>
<button onClick="example.modeSelect('slideshow');">Images</button>
</div>
<div class="item-select buttons">
<button onClick="example.itemSelect(1);">Item #1</button>
<button onClick="example.itemSelect(2);">Item #2</button>
<button onClick="example.itemSelect(3);">Item #3</button>
<button onClick="example.toTime(2);">2 sec</button>
<button onClick="example.toTime(1);">1 sec</button>
</div>
<div class="toggle buttons">
<button onClick="example.playToggle();">Play / Pause</button>
<button onClick="example.muteToggle();">Mute / Unmute</button>
</div>
<div>
<h2>Currently Playing: <span id="currItem"></span></h2>
</div>
</div>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react-with-addons.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.14.3/react-dom.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"></script>
<script src="react-drive-in-browser.js"></script>
<script type="text/babel">
/* eslint no-unused-vars:0 */
const PLAYLIST = [
[
"https://github.com/ronik-design/react-drive-in/blob/master/example/pelo.mp4?raw=true",
"https://github.com/ronik-design/react-drive-in/blob/master/example/pelo.ogv?raw=true",
"https://github.com/ronik-design/react-drive-in/blob/master/example/pelo.jpg?raw=true"
],
[
"https://github.com/ronik-design/react-drive-in/blob/master/example/kaledo.mp4?raw=true",
"https://github.com/ronik-design/react-drive-in/blob/master/example/kaledo.ogv?raw=true",
"https://github.com/ronik-design/react-drive-in/blob/master/example/kaledo.jpg?raw=true"
],
[
"https://github.com/ronik-design/react-drive-in/blob/master/example/glacier.mp4?raw=true",
"https://github.com/ronik-design/react-drive-in/blob/master/example/glacier.ogv?raw=true",
"https://github.com/ronik-design/react-drive-in/blob/master/example/glacier.jpg?raw=true"
]
];
const React = window.React;
const ReactDOM = window.ReactDOM;
const DriveIn = window.ReactDriveIn;
const driveInEl = document.getElementById("drive-in");
const example = {};
let currMode = "video";
let driveIn;
const onPlaying = function (itemNum) {
document.getElementById("currItem").innerHTML = itemNum + 1;
};
example.modeSelect = function (mode) {
if (mode === currMode) {
return;
}
currMode = mode;
ReactDOM.unmountComponentAtNode(driveInEl);
driveIn = ReactDOM.render(
<DriveIn
showPlaylist={PLAYLIST}
onPlaying={onPlaying}
slideshow={(mode === "slideshow")}
/>,
driveInEl
);
};
example.itemSelect = function (itemNum) {
driveIn.play(itemNum - 1);
};
example.toTime = function (time) {
driveIn.seekTo(time);
};
example.playToggle = function () {
if (driveIn.state.playing) {
driveIn.pause();
} else {
driveIn.play();
}
};
example.muteToggle = function () {
if (driveIn.state.mute) {
driveIn.unmute();
} else {
driveIn.mute();
}
};
window.example = example;
driveIn = ReactDOM.render(
<DriveIn
showPlaylist={PLAYLIST}
onPlaying={onPlaying}
slideshow={false}
loopPlaylistItems
paused
/>,
driveInEl
);
</script>
</body>
</html>