forked from ronik-design/react-drive-in
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
169 lines (154 loc) · 5.08 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
<!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" href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css">
<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%;
}
.content {
position: relative;
top: 50%;
transform: translateY(-50%);
-webkit-transform: translateY(-50%);
text-align: center;
}
h1 {
font-family: 'Mouse Memoirs', sans-serif;
margin: 0px;
}
.car {
display: inline-block;
position: relative;
font-size: 900%;
}
.car svg {
position: absolute;
top: 75px;
left: 10px;
}
button {
width: 70px;
height: 70px;
background-color:#000;
border: 1px solid #000;
color: #fff;
border-radius: 35px;
margin: .5em;
}
button:focus {
outline: 0;
}
.buttons {
padding: .2em;
}
</style>
</head>
<body>
<div class="content">
<div class="mode-select buttons">
<button onClick="modeSelect('video');">Videos</button>
<button onClick="modeSelect('slideshow');">Images</button>
</div>
<div class="item-select buttons">
<button onClick="itemSelect(1);">Item #1</button>
<button onClick="itemSelect(2);">Item #2</button>
<button onClick="itemSelect(3);">Item #3</button>
<button onClick="toTime(2);">2 sec</button>
<button onClick="toTime(1);">1 sec</button>
</div>
<div class="toggle buttons">
<button onClick="playToggle();">Play / Pause</button>
<button onClick="muteToggle();">Mute / Unmute</button>
</div>
<div class="car">
<svg width="145" height="35" xmlns="http://www.w3.org/2000/svg">
<rect width="145" height="35"/>
</svg>
<i class="fa fa-car"></i>
</div>
<div>
<h2>Currently Playing: <span id="currItem"></span></h2>
</div>
</div>
<div id="drive-in"></div>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.13.2/react-with-addons.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.13.2/JSXTransformer.js"></script>
<script src="react-drive-in.js"></script>
<script type="text/jsx">
/** @jsx React.DOM */
var DriveIn = ReactDriveIn,
driveInEl = document.getElementById('drive-in'),
driveIn;
var currMode = 'video';
function onPlaying(itemNum) {
document.getElementById('currItem').innerHTML = itemNum + 1;
}
function modeSelect(mode) {
if (mode === currMode) return;
currMode = mode;
React.unmountComponentAtNode(driveInEl);
driveIn = React.render(
<DriveIn
showPlaylist={playlist}
onPlaying={onPlaying}
slideshow={(mode === 'slideshow')}
/>,
driveInEl
);
}
function itemSelect(itemNum) {
driveIn.play(itemNum - 1);
}
function toTime(time) {
driveIn.seekTo(time);
}
function playToggle() {
if (driveIn.state.playing) {
driveIn.pause();
} else {
driveIn.play();
}
}
function muteToggle() {
if (driveIn.state.mute) {
driveIn.unmute();
} else {
driveIn.mute();
}
}
var 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'
]
];
driveIn = React.render(
<DriveIn
showPlaylist={playlist}
onPlaying={onPlaying}
slideshow={false}
loopPlaylistItems={true}
/>,
driveInEl
);
</script>
</body>
</html>