-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
294 lines (294 loc) · 9.25 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE HTML>
<html>
<head>
<title>SuperPlayer</title>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="assets/demo/demo.css">
<link rel="stylesheet" href="assets/superplayer.min.css">
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="assets/superplayer.min.js"></script>
</head>
<body>
<h1>basic usage</h1>
<p>Using SuperPlayer is very easy. To use SuperPlayer, you need to include jQuery, <em>superplayer.js</em>/<em>superplayer.min.js</em>, and <em>superplayer.css</em>/<em>superplayer.min.css</em></p>
<textarea><script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="assets/superplayer.js"></script>
<link rel="stylesheet" href="assets/superplayer.css"></textarea>
<p><em>Or</em></p>
<textarea><script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="assets/superplayer.min.js"></script>
<link rel="stylesheet" href="assets/superplayer.min.css"></textarea>
<p>Do not use both <em>superplayer.js</em> and <em>superplayer.min.js</em> - Only use one.</p>
<p>Do not use both <em>superplayer.css</em> and <em>superplayer.min.css</em> - Only use one.</p>
<h1>examples</h1>
<h2>single-song demo</h2>
<div id="singledemo"></div>
<textarea readonly>$( -- host element selector -- ).superplayer({
items: [
{
src: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
title: '<b>Mules</b> - "Teenage Freakout"'
}
]
});</textarea>
<p>In this example, the item does not have an image, so the default image is used instead.</p>
<hr />
<h2>multi-song demo</h2>
<div id="multidemo"></div>
<textarea readonly>$( -- host element selector -- ).superplayer({
items: [
{
src: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
image: 'assets/demo/fma.png',
title: '<b>Mules</b> - "Teenage Freakout"',
download: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
loop: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3'
},
{
src: 'assets/demo/Mules_-_01_-_Shock_ya.mp3',
image: 'assets/demo/mules.jpg',
title: '<b>Mules</b> - "Shock Ya"'
}
]
});</textarea>
<p>In this example, the first item has the "loop" variable set to true, meaning it will loop by default. The user can turn loop on/off for any item.</p>
<p>In this example, the first item has the "download" variable set, meaning a download button will be shown which will go to a download/purchase page for the audio file.</p>
<hr />
<h2>header demo</h2>
<div id="headerdemo"></div>
<textarea readonly>$( -- host element selector -- ).superplayer({
header: {
text: 'My Music Player',
image: 'assets/demo/meatar.png'
},
items: [
{
src: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
image: 'assets/demo/fma.png',
title: '<b>Mules</b> - "Teenage Freakout"',
}
]
});</textarea>
<p>In the example, the SuperPlayer has a header. To add a header, just add the "header" variable, with the variables "text" and "image" (image is optional).</p>
<h1>usage</h1>
<ol>
<li>Create a host element in which the SuperPlayer will be held (example: '<span style="color:blue;"><div</span> <span style="color:red;">id</span>=<span style="color:purple;">"musicplayer"</span><span style="color:blue;">></div></span>')
<li>Call SuperPlayer via JavaScript with the audio items attached (it is recommend that this is done so after the page has loaded)
<dt>To call SuperPlayer, you do so using this JavaScript code:</dt>
</li>
</ol>
<textarea readonly>$( -- host element selector -- ).superplayer({
header: {
text: 'My Music Player',
image: 'image.png' // optional
}, // optional
items: [
{
title: 'Song 1',
image: 'SONG1.png', // optional
src: 'song.mp3',
loop: true // optional
}
...
]
});</textarea>
<ul>
<dt>You'll need to set the variable to the appropriate values.</dt>
<ol style="list-style-type:lower-alpha;">
<li>Set the "title" variable to the title of the song you wish to be displayed. (required)</li>
<li>Set the "image" variable to the song cover image you wish to be displayed. (optional)</li>
<li>Set the "src" variable to the URL to the music file you wish to have played. (required)</li>
</ol>
</ul>
<ol start="3">
<li>You can add as many items as you wish, just add more arrays to the "items" array. Here's an example of a player with 3 songs:</li>
</ol>
<textarea readonly>$( -- host element selector -- ).superplayer({
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3'
},
{
title: 'Song 2',
image: 'SONG2.png',
src: 'song2.mp3'
},
{
title: 'Song 3',
image: 'SONG3.png',
src: 'song3.mp3'
}
]
});</textarea>
<h1>extras</h1>
<h2>volume</h2>
<ul>
<li>You can add a "volume" variable to the SuperPlayer function to set the default volume for the SuperPlayer.</li>
<dt>Here's an example where the audio will be played at 50% volume:</dt>
</ul>
<textarea readonly>$( -- host element selector -- ).superplayer({
volume: 50,
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3'
}
]
});</textarea>
<h2>auto play</h2>
<ul>
<li>You can add the "autoplay" variable to the SuperPlayer function to make it automatically start playing the first item.</li>
<dt>Here's an example where the SuperPlayer will automatically start playing:</dt>
</ul>
<textarea readonly>$( -- host element selector -- ).superplayer({
autoplay: true,
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3'
}
]
});</textarea>
<h2>header</h2>
<ul>
<li>You can add the "loop" variable to an item to set it to loop by default. The user can turn loop on/off for any song.</li>
<li>Your header can have an image also. The "image" variable is not required and no image will display if not set.</li>
<dt>Here's an example of a SuperPlayer with a header:</dt>
</ul>
<textarea readonly>$( -- host element selector -- ).superplayer({
header: {
text: 'My Music Player',
image: 'image.png'
},
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3'
}
]
});</textarea>
<h2>loop</h2>
<ul>
<li>You can add the "loop" variable to an item to set it to loop by default. The user can turn loop on/off for any song.</li>
<dt>Here's an example where the first song will loop by default, and not the second:</dt>
</ul>
<textarea readonly>$( -- host element selector -- ).superplayer({
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3',
loop: true
},
{
title: 'Song 2',
image: 'SONG2.png',
src: 'song2.mp3'
}
]
});</textarea>
<h2>download button</h2>
<ul>
<li>You can add the "download" variable to an item to put a download button on the player for this item.</li>
<dt>Here's an example where the first song will show a download button with a spacific, and not the second:</dt>
<dt>The download link may be set to any link, not just the URL of the audio.</dt>
</ul>
<textarea readonly>$( -- host element selector -- ).superplayer({
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3',
download: 'song.mp3'
},
{
title: 'Song 2',
image: 'SONG2.png',
src: 'song2.mp3'
}
]
});</textarea>
<h2>hidden controls</h2>
<ul>
<li>You hide the audio controls by adding the "hidecontrols" variable to the SuperPlayer.</li>
<dt>Here's an example of a SuperPlayer that will not have audio controls:</dt>
</ul>
<textarea readonly>$( -- host element selector -- ).superplayer({
hidecontrols: true,
items: [
{
title: 'Song 1',
image: 'SONG1.png',
src: 'song.mp3',
}
]
});</textarea>
</body>
<script>
$('textarea').click(function(){
$(this).select();
});
$('#singledemo').superplayer({
items: [
{
src: [
{
link: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
type: 'audio/mp3'
}
],
title: '<b>Mules</b> - "Teenage Freakout"'
}
]
});
$('#multidemo').superplayer({
items: [
{
src: [
{
link: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
type: 'audio/mp3'
}
],
image: 'assets/demo/fma.png',
title: '<b>Mules</b> - "Teenage Freakout"',
download: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
loop: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3'
},
{
src: [
{
link: 'assets/demo/Mules_-_01_-_Shock_ya.mp3',
type: 'audio/mp3'
}
],
image: 'assets/demo/mules.jpg',
title: '<b>Mules</b> - "Shock Ya"'
}
]
});
$('#headerdemo').superplayer({
header: {
text: 'My Music Player',
image: 'assets/demo/meatar.png'
},
items: [
{
src: [
{
link: 'assets/demo/Mules_-_02_-_Teenage_Freakout.mp3',
type: 'audio/mp3'
}
],
image: 'assets/demo/fma.png',
title: '<b>Mules</b> - "Teenage Freakout"',
}
]
});
</script>
</html>