/
demo.html
562 lines (465 loc) · 18.8 KB
/
demo.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
jquery.mb.components –
–
file: demo.html –
last modified: 09/07/14 23.11 –
–
Open Lab s.r.l., Florence - Italy –
–
email: matteo@open-lab.com –
site: http://pupunzi.com –
http://open-lab.com –
blog: http://pupunzi.open-lab.com –
Q&A: http://jquery.pupunzi.com –
–
Licences: MIT, GPL –
http://www.opensource.org/licenses/mit-license.php –
http://www.gnu.org/licenses/gpl.html –
–
Copyright (c) 2001-2014. Matteo Bicocchi (Pupunzi); –
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-->
<title>youtube Chromeless Player - mb.YTPlayer</title>
<link href='http://fonts.googleapis.com/css?family=Lekton|Lobster' rel='stylesheet' type='text/css'>
<link href="../dist/css/jquery.mb.YTPlayer.min.css" media="all" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="../dist/jquery.mb.YTPlayer.js"></script>
<script src="assets/apikey.js"></script>
<style>
*:focus{
outline: none;
}
body {
border: none;
margin: 0;
padding: 30px;
background: #222c2f;
font: normal 16px/20px Lekton, sans-serif;
}
input, textarea, select, button {
font-family: "helvetica neue", sans-serif !important;
}
h1{
text-align: center;
font-size: 50px;
font-family: 'Lobster', cursive;
}
h2{
font-family: "Open Sans", sans-serif;
font-size: 35px;
text-align: left;
line-height: 60px;
}
h1, h2{
font-family: 'Lobster', cursive;
text-shadow: 10px 10px 20px rgba(0, 0, 0, 0.30);
color: #000000;
font-weight: 200;
}
#wrapper{
position: relative;
min-width: 1280px;
}
.console{
margin-top: 70px;
text-align: center;
}
#debug {
position: absolute;
width: 450px;
padding: 5px;
height: 100%;
top: 0;
right: 0;
background: rgba(0, 0, 0, .8);
overflow: auto;
color: #fff;
font-size: 13px;
z-index: 10000;
}
.dida{
color: #fff;
font-size: 20px;
margin-top: 20px;
}
button, .button {
transition: all .4s;
display: inline-block;
padding: 0px 10px;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
cursor: pointer;
background-color: rgba(248, 248, 248, 0.4);
box-shadow: 0 0 4px rgba(0,0,0,0.4);
color:#000;
border: 1px solid transparent;
text-decoration: none;
line-height: 30px;
margin: 3px;
border-radius: 10px;
}
button:hover, .button:hover {
background-color: rgb(0, 0, 0);
color: #FFF;
}
#togglePlay{
margin-top: 20px;
font-size: 20px;
width: 100px;
height: 100px;
line-height: 70px;
border-radius: 100%;
}
#togglePlay.pause{
background-color: rgb(0, 0, 0);
color: #fff;
}
#togglePlay.pause:hover{
background-color: #fff;
color: #333;
}
#togglePlay.play{
background-color: #fff;
color: #333;
}
#togglePlay.play:hover{
background-color: rgb(0, 0, 0);
color: #fff;
}
.goto {
position: absolute;
left:0;
top: 360px;
right: 0;
margin: auto;
text-align: center;
width: 100%;
height: 50px;
}
.goto .button{
font-size: 30px;
font-family: 'Lobster', cursive;
padding: 10px;
text-transform: none;
}
#filtersControl{
position: absolute;
top:0;
left: 10px;
width: 350px;
margin: 30px auto;
z-index: 1000;
}
#changeVideo {
position: absolute;
top: 0;
right: 10px;
width: 350px;
margin: 30px auto;
z-index: 100;
padding: 10px;
/*background-color: rgba(25, 34, 37, 0.35);*/
border-radius: 10px;
color: #FFFFFF;
box-sizing: border-box;
}
#changeVideo label {
padding: 10px;
display: block;
}
#changeVideo input {
padding: 10px;
display: block;
width: 250px;
border-radius: 10px;
border: none;
font-size: 20px;
color: #fff;
font-weight: 700;
background-color: rgba(168, 168, 168, 0.20);
}
#changeVideo input[type=number] {
display: inline-block;
width: 100px;
}
#changeVideo input[type=checkbox] {
display: inline-block;
width: 20px;
}
#loadBox{
background-color: rgba(168, 168, 168, 0.20);
border-radius: 10px;
padding: 20px;
}
/*Slider START ************************************************/
#filterScript {
margin-top: 20px;
padding: 10px;
background-color: rgba(25, 34, 37, 0.35);
color: #fff;
border-radius: 10px;
}
.slider {
position: relative;
width: 100%;
height: 25px;
border: 0 solid transparent;
background-color: rgba(255, 255, 255, 0.20);
border-radius: 4px;
margin-top: 10px;
overflow: hidden;
}
.slider:hover {
background-color: rgba(255, 255, 255, 0.46);
}
.slider .level {
background-color: rgba(255, 255, 255, 0.80);
height: 100%;
border-right: 5px solid rgba(168, 168, 168, 0.60);
}
.slider .desc {
position: absolute;
right: 0;
top: 0;
padding: 5px;
font-size: 12px;
line-height: 18px;
color: #222222;
}
.slider span {
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
/*text-transform: uppercase;*/
position: absolute;
top: 0;
font-size: 12px;
line-height: 18px;
color: #222222;
padding: 4px;
text-align: left;
width: 100%;
box-sizing: border-box;
}
/*Slider END ************************************************/
</style>
<script>
var myPlayer;
jQuery(function () {
var isIframe=function(){var a=!1;try{self.location.href!=top.location.href&&(a=!0)}catch(b){a=!0}return a};if(!isIframe()){var logo=$("<a href='http://pupunzi.com/#mb.components/components.html' style='position:absolute;top:0;z-index:1000'><img id='logo' border='0' src='http://pupunzi.com/images/logo.png' alt='mb.ideas.repository'></a>");$("#wrapper").prepend(logo),$("#logo").fadeIn()}
myPlayer = jQuery("#bgndVideo").YTPlayer({align:"center,left"});
myPlayer.YTPApplyFilters({
grayscale: 50,
sepia: 83,
opacity: 29
});
/* DEBUG ******************************************************************************************/
var YTPConsole = jQuery("#eventListener");
// EVENT: YTPStart YTPEnd YTPLoop YTPPause YTPBuffering
myPlayer.on("YTPReady YTPStart YTPEnd YTPPlay YTPLoop YTPPause YTPBuffering YTPMuted YTPUnmuted YTPChangeMovie", function (e) {
YTPConsole.append("event: " + e.type + " (" + jQuery("#bgndVideo").YTPGetPlayer().getPlayerState() + ") > time: " + e.time);
YTPConsole.append("<br>");
});
// EVENT: YTPChanged
myPlayer.on("YTPChanged", function (e) {
YTPConsole.html("");
});
myPlayer.on("YTPChangeMovie", function(e){
// console.debug("videoId :: ", e.videoId);
});
// EVENT: YTPData
myPlayer.on("YTPData", function (e) {
$(".dida").html(e.prop.title + "<br>@" + e.prop.channelTitle);
$("#videoData").show();
YTPConsole.append("******************************");
YTPConsole.append("<br>");
YTPConsole.append(e.type);
YTPConsole.append("<br>");
YTPConsole.append(e.prop.title);
YTPConsole.append("<br>");
YTPConsole.append(e.prop.description.replace(/\n/g, "<br/>"));
YTPConsole.append("<br>");
YTPConsole.append("******************************");
YTPConsole.append("<br>");
});
// EVENT: YTPTime
myPlayer.on("YTPTime", function (e) {
var currentTime = e.time;
var traceLog = currentTime / 5 == Math.floor(currentTime / 5);
if (traceLog && YTPConsole.is(":visible")) {
YTPConsole.append(myPlayer.attr("id")+ " > " + e.type + " > actual time is: " + currentTime);
YTPConsole.append("<br>");
if(myPlayer.YTPGetFilters())
console.debug("filters: ", myPlayer.YTPGetFilters());
}
});
/* END DEBUG ******************************************************************************************/
/* FILTER SLIDERS ******************************************************************************************/
// create sliders for filters adjustment
$(".slider").each(function(){
var $slider = $(this);
$slider.simpleSlider({
initialval: 0, //function (el) {return Math.random() * el.opt.scale},
scale : 100,
callback : function (el) {
var filter = $(el).data("filter");
myPlayer.YTPApplyFilter(filter, +(el.value).toFixed(0));
$("span",el).html(filter + " (" + (+(el.value).toFixed(0)) + ")");
var applFilters = [];
var desc = "$(selector).YTPApplyFilters({";
for (var x=0; x < $(".slider").length; x++ ){
var slider = $(".slider").eq(x).get(0);
var $slaider = $(slider);
if(slider.value)
applFilters.push($slaider.data("filter") + ": " + (+(slider.value).toFixed(0)) );
};
for (var y in applFilters){
var comma = y < applFilters.length-1 ? "," : "<br>";
desc += "<br> " + applFilters[y] + comma;
}
desc += "})";
$("#filterScript").html(desc);
}
});
});
//update applied filters
myPlayer.on("YTPFiltersApplied", function(){
var filters = myPlayer.get(0).filters;
for (var key in filters){
$(".slider[data-filter="+key+"]").updateSliderVal(filters[key].value);
}
});
/* END FILTER SLIDERS ******************************************************************************************/
});
/**
*
* @param state
*/
function changeLabel(state){
$("#togglePlay").html(state != 1 ? "pause" : "play");
$("#togglePlay").removeClass(state != 1 ? "play" : "pause");
$("#togglePlay").addClass(state != 1 ? "pause" : "play");
}
/**
*
* @param val
* @returns {*|number}
*/
function checkForVal(val){
return val || 0;
}
</script>
</head>
<body>
<div id="wrapper" style="position:relative; padding:10px 0;z-index:10">
<div class="console">
<button onclick="jQuery('#bgndVideo').YTPToggleVolume()">mute/unmute</button>
<button onclick="jQuery('#bgndVideo').YTPFullscreen()">go fullscreen</button>
<button id="debugBtn" class="command" onclick="jQuery('#debug').toggle()"> show/hide the console</button>
</div>
<br>
<br>
<h1 style="color:white">jQuery.mb.YTPlayer</h1>
<h2 style="color:white; text-align: center">An HTML5 Background player<br>for YouTube videos</h2>
<div id="filtersControl">
<h2 style="color:white">Apply filters</h2>
<h3 style="color: white">* Filters don't work in IE.</h3>
<button id="toggleFilters"
onclick="jQuery('#bgndVideo').YTPToggleFilters(function(a){if(!a) {$('#toggleFilters').html('enable filters')} else {$('#toggleFilters').html('disable filters')}})">
disable all filters
</button>
<script>
function rFCallback(f){
$(".slider[data-filter="+f+"]").updateSliderVal(0);
}
</script>
<button id="removeFilters"
onclick="jQuery('#bgndVideo').YTPRemoveFilter(rFCallback)">
remove all filters
</button>
<div class="slider"
data-filter="grayscale"><span>grayscale</span>
</div>
<div class="slider"
data-filter="sepia"><span>sepia</span>
</div>
<div class="slider"
data-filter="hue_rotate"
data-scale="360"><span>hue rotate</span>
</div>
<div class="slider"
data-filter="invert"><span>invert</span>
</div>
<div class="slider"
data-filter="opacity"><span>opacity</span>
</div>
<div class="slider"
data-filter="saturate"
data-scale="1000"><span>saturate</span>
</div>
<div class="slider"
data-filter="brightness"
data-scale="200"><span>brightness</span>
</div>
<div class="slider"
data-filter="contrast"
data-scale="500"><span>contrast</span>
</div>
<div class="slider"
data-filter="blur"
data-scale="50"><span>blur</span>
</div>
<div id="filterScript"></div>
</div>
<div id="changeVideo">
<h2 style="color:white">Change video</h2>
<!--<button class="command" onclick="jQuery('#bgndVideo').YTPChangeMovie({videoURL: 'Fk9EBOOAYiU', mute:false, addRaster:false})">video 1</button>-->
<button class="command" onclick="jQuery('#bgndVideo').YTPChangeMovie({videoURL: '7SnmCUwOsts', mute:false, addRaster:false})">video 1</button>
<button class="command" onclick="jQuery('#bgndVideo').YTPChangeMovie({videoURL: 'BsekcY04xvQ', mute:false, addRaster:false})">video 2</button>
<button class="command" onclick="jQuery('#bgndVideo').YTPChangeMovie({videoURL: 'kcihcYEOeic', mute:false, startAt:10, addRaster:false})">video 3</button>
<br>
<br>
<div id="loadBox">
<label for="videoID">Or insert here the ID or the complete URL of the Youtube video:</label>
<input id="videoID" type="text" value="r1xohS2u69E" onfocus="$('#loadOptions').slideDown()">
<div id="loadOptions" style="display: none">
<br>
<input id="startAt" type="number" placeholder="starts at">
<input id="stopAt" type="number" placeholder="stops at">
<br>
<br>
<input id="audioOff" type="checkbox" checked> Audio is OFF
<br>
</div>
<br>
<button onclick="$('#loadOptions').slideUp(); jQuery('#bgndVideo').YTPChangeMovie({videoURL: $('#videoID').val(), startAt: checkForVal($('#startAt').val()), stopAt: checkForVal($('#stopAt').val()), mute: $('#audioOff').is(':checked') })">change video</button>
<div id="videoData" style="display: none">
<h2 style="color: #FFFFFF; text-align: left">Current video:</h2>
<div class="dida"></div>
</div>
<br>
<button onclick="jQuery.mbYTPlayer.removeStoredData()"> Remove stored data </button>
</div>
</div>
<div class="goto">
<button id="togglePlay" class="command pause" onclick="jQuery('#bgndVideo').YTPTogglePlay(changeLabel)">pause</button>
<br>
<br>
<br>
<a class="button" href="https://github.com/pupunzi/jquery.mb.YTPlayer/wiki" target="_blank">See the doc</a>
<a class="button" href="http://pupunzi.open-lab.com/mb-jquery-components/jquery-mb-ytplayer" target="_blank">Download it</a>
</div>
<a style="position: fixed;bottom:40px;right: 30px;" href="http://pupunzi.open-lab.com/consider-a-donation/" target="_blank">
<img border="0" alt="PayPal" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG_global.gif" class="alignright">
</a>
<!--7SnmCUwOsts--><!--BsekcY04xvQ--><!--r1xohS2u69E--><!--Fk9EBOOAYiU--><!--sEuXfDtrco8--><!--9d8wWcJLnFI-->
<div id="bgndVideo" class="player" data-property="{videoURL:'2yacT1XMjsg',containment:'body', showControls:true, autoPlay:true, loop:false, vol:50, mute:false, startAt:0, stopAt:296, opacity:1, addRaster:true, quality:'large', optimizeDisplay:true}">My video</div>
</div>
<div id="debug" style="display: none">
<h2 style="color: #FFFFFF; text-align: left">Events console: </h2>
<div id="eventListener"></div>
</div>
</body>
</html>