/
test.html
424 lines (363 loc) · 18 KB
/
test.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
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta http-equiv="expires" content="0">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML5 Video Puzzle - learning the new HTML5 technologies</title>
<meta name="title" content="HTML5 Video Puzzle - learning the new HTML5 technologies" />
<meta name="description" content="This is a learning tool for the new HTML5 technologies" />
<meta name="keywords" content="html, css, html5, css3, canvas, animation, requestanimationframe, fullscreen, fullscreen api, cache, application cache, application cache api, appcache, audio, audio api, video, video api, modernizr" />
<meta name="author" content="Emerson Estrella">
<link type="text/plain" rel="author" href="humans.txt" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/libs/modernizr.custom.01885.js?asdf=123"></script>
</head>
<body>
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
<a href="https://github.com/edse/puzzletube" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0; margin-top: 40px;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="./">HTML5 Video Puzzle</a>
<div class="nav-collapse">
<ul class="nav">
<li id="home" class="active"><a href="./">Home</a></li><!--
<li id="play"><a href="javascript: start();">Play</a></li>
<li id="pause" class="control"><a href="javascript: pause();">Pause</a></li>
<li id="autosnap" class="control"><a href="javascript: window.m.autoSnap();">Auto-Snap On</a></li>
<li id="autosnapoff" class="control"><a href="javascript: window.m.autoSnapOff();">Auto-Snap Off</a></li>
<li id="fullscreen" class="control"><a href="javascript: screenfull.toggle();">Fullscreen</a></li>
<li id="exitfullscreen" class="control"><a href="javascript: screenfull.toggle();">Exit Fullscreen</a></li>
<li id="sfx" class="control"><a href="javascript: window.m.startSFX();">SFX On</a></li>
<li id="sfxoff" class="control"><a href="javascript: window.m.stopSFX();">SFX Off</a></li>-->
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div id="modal-success" class="modal hide fade" style="display: none; ">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h1>Yes, you did it!</h1>
</div>
<div class="modal-body">
<p><span id="stage" class="label label-success">Stage 1 completed!</span></p>
<p><span id="pieces" class="label label-warning">4 pieces in 30s</span></p>
<!--
<h4>Popover in a modal</h4>
<p>This <a href="#" class="btn popover-test" data-content="And here's some amazing content. It's very engaging. right?" data-original-title="A Title">button</a> should trigger a popover on hover.</p>
<h4>Tooltips in a modal</h4>
<p><a href="#" class="tooltip-test" data-original-title="Tooltip">This link</a> and <a href="#" class="tooltip-test" data-original-title="Tooltip">that link</a> should have tooltips on hover.</p>
-->
<hr />
</div>
<div class="modal-footer">
<!--<a href="#" class="btn" data-dismiss="modal">No thanks</a>-->
<a href="#" class="btn btn-primary" id="next">Next Stage</a>
</div>
</div>
<div class="container-fluid bg">
<div class="row-fluid">
<div class="span3">
<div class="hidden-phone" style="text-align: center; margin-bottom: 20px">
<script type="text/javascript">
if(window.innerWidth > 480) {
//visible-tablet & desk
//Wide Skyscraper
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "7393764163";
google_ad_width = 160;
google_ad_height = 600;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
}
</script>
</div>
</div><!--/span-->
<div class="span9">
<div class="visible-desktop row-fluid show-grid">
<div class="span12" style="text-align: center; margin-bottom: 20px">
<script type="text/javascript">
if(window.innerWidth >= 980) {
//visible-desktop
/* New Leader */
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "5326073161";
google_ad_width = 728;
google_ad_height = 90;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
}
</script>
</div>
</div>
<div class="hidden-desktop2 row-fluid show-grid">
<div class="span12" style="text-align: center; margin-bottom: 20px">
<script type="text/javascript">
if(window.innerWidth < 980) {
//visible-tablet & phone
//Banner
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "6679550646";
google_ad_width = 468;
google_ad_height = 60;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
}
</script>
</div>
</div>
<div class="hero-unit" style="padding-bottom: 15px;">
<div id="promo" class="alert alert-block alert-message fade in span2" style="float: right">
<button class="close" data-dismiss="alert">×</button>
<h4 class="alert-heading">Check this out!</h4>
<p>HTML5 Video Puzzle. The same puzzle game, but using <strong>YouTube videos</strong> intead still images.</p>
<p>
<a class="btn btn-small btn-info" href="http://html5videopuzzle.appspot.com"><i class="icon-info-sign icon-white"></i> HTML5 VIDEO PUZZLE</a> <!--<a class="btn" href="#">No, thanks</a>-->
</p>
</div>
<div id="vid" style="display: block;"></div>
<h1 class="brand">HTML5 Video Puzzle</h1>
<h2>Building a game for learning HTML5</h2>
<h3>HTML5 Learning Features in this game:</h3>
<ul>
<li>Canvas</li>
<li>Image manipulation</li>
<li>RequestAnimationFrame</li>
<li>Fullscreen API</li>
<li>Application Cache API</li>
<li>Audio API</li>
<li>Mouse, keyboard, and touch support</li>
</ul>
<h3>Game Concept:</h3>
<ul>
<li>The player has to place all pieces in the given time</li>
<li>There are infinite stages</li>
<li>Every new stage the number of pieces and the time to accomplish increases</li>
</ul>
<!--
<div class="alert" style="opacity: 0.7">
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
</div>
-->
<p><a href="javascript: start();" class="btn btn-danger btn-large" style="font-size: 40px; margin-bottom: 25px; margin-top: 25px;">Play Now »</a></p>
</div>
<div class="row-fluid">
<div class="hidden-desktop" style="text-align: center; margin-bottom: 20px">
<script type="text/javascript">
if(window.innerWidth < 800) {
//visible-tablet
//Large Rectangle
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "7499424968";
google_ad_width = 336;
google_ad_height = 280;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
}
</script>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h2>Canvas, image manipulation, and RequestAnimationFrame</h2>
<p>The game runs on canvas. It loads an image and slice it in a few pieces. The RequestAnimationFrame provide power efficient and smooth animations.</p>
<p><a class="btn" href="http://coding-everyday.blogspot.com.br/2012/04/html5-polyfills-fullscreen.html">View details »</a></p>
</div><!--/span-->
<div class="span4">
<h2>Audio, and fullscreen APIs</h2>
<p>Background music and sound effects using the Audio API. Also fullscreen mode support.</p>
<p><a class="btn" href="http://coding-everyday.blogspot.com.br/2012/04/html5-appcache-api-how-to-prevent.html">View details »</a></p>
</div><!--/span-->
<div class="span4">
<h2>Application Cache / Offline browsing support</h2>
<p>You can keep playing even when you go offline.</p>
<p><a class="btn" href="http://coding-everyday.blogspot.com.br/2012/04/html5-appcache-api-how-to-prevent.html">View details »</a></p>
</div><!--/span-->
</div><!--/row-->
<div class="row-fluid" style="margin-top: 25px;">
<div class="span12">
<h2>Want to know how to build a HTML5 game like this?</h2>
<p>Check out the tutorial: Step-by-step creating a HTML5 Video Puzzle game</p>
<p><a class="btn btn-large btn-primary" href="http://coding-everyday.blogspot.com.br/2012/10/step-by-step-creating-html5-image.html">Step-by-step creating a HTML5 Video Puzzle game »</a></p>
</div><!--/span-->
</div><!--/row-->
<div class="row-fluid" style="margin-top: 25px;">
<div class="hidden-phone2" style="text-align: center; margin-bottom: 20px">
<script type="text/javascript">
if(window.innerWidth >= 800) {
//visible-desktop
/* New Leader */
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "5326073161";
google_ad_width = 728;
google_ad_height = 90;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
}
else if(window.innerWidth > 480) {
//visible-tablet & desk
//Banner
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "6679550646";
google_ad_width = 468;
google_ad_height = 60;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
}
/*
//Large Rectangle
google_ad_client = "ca-pub-6794644097825747";
google_ad_slot = "7499424968";
google_ad_width = 336;
google_ad_height = 280;
document.write('<scr'+'ipt type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"></scri'+'pt>');
*/
</script>
</div>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<hr>
<footer class="content">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">html5 Puzzle</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://html5puzzle.appspot.com" property="cc:attributionName" rel="cc:attributionURL">Emerson Estrella</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://html5rocks.com" rel="dct:source">html5rocks.com</a>.
</footer>
</div><!--/.fluid-container-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script>
<script src="js/libs/bootstrap/bootstrap.min.js"></script>
<script>
var _gaq=[['_setAccount','UA-31479393-1'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<!-- Game scripts -->
<script>
$(function() {
//alert(unescape(unescape("codecs%253D%2522avc1.42001E%252C%2Bmp4a.40.2%2522%26fallback_host%3Dtc.v")));
var id = "b4VsluhWVh8";
id = "5KlnlCq2M5Q";
$.ajax({
url: "http://www.youtube.com/get_video_info?video_id="+id,
dataType: "text"
}).done(function(data) {
var results = [];
var r = 0;
data = (data+'').replace(/\+/g, '%20');
data = data.replace(/url%3D/g, '\n\r\n\r<break>');
data = data.replace(/sig%3D/g, 'signature%3D');
//console.log(data);
var urls = data.split('<break>');
for(var u = 0; u < urls.length; u++){
var result = {};
var d = unescape(unescape(decodeURIComponent((urls[u]+'').replace(/\+/g, '%20'))));
d = d.replace(/="/g, '%3D%22');
d = d.replace(/"/g, '%22');
var url = d;
console.log(d);
console.log(d.length);
if(d.length > 1500){
aux = d.split('&has_cc');
d = aux[0];
}
var vars = [], hash;
var hashes = d.slice(d.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = unescape(hash[1]);
}
if(vars['type']!=undefined){
console.log(vars['type']);
result.type = vars['type'];
if(vars['type'].indexOf("codecs")>0){
var cs = vars['type'].split(';+codecs="');
console.log(cs[0]);
console.log(cs[1].replace('"','').replace('+',' '));
result.type = cs[0];
result.codecs = cs[1].replace('"','').replace('+',' ');
}
}else
console.log(vars['type']);
//quality
if(vars['quality']!=undefined){
result.quality = vars['quality'];
if(vars['quality'].indexOf(",")>0){
var cs = vars['quality'].split(',');
console.log(cs[0]);
result.quality = cs[0];
}else
console.log(vars['quality']);
}
if(result.type && result.quality){
result.url = url;
results[r] = result;
r++;
}
//console.log(vars);
//src = vars["url_encoded_fmt_stream_map"];
}
//console.log(vars);
//var src = vars["url_encoded_fmt_stream_map"];
/*
//data = data.replace('url%3D', '');
//data = data.replace('itag%3D44', '');
data = decodeURIComponent((data+'').replace(/\+/g, '%20'));
data = data.replace('url%3D', '');
data = data.replace('itag%3D44', '');
console.log(data);
console.log('Video src: '+src);
if(typeof(src) == "undefined"){
if(Modernizr.video.ogg)
src = "video/BigBuckBunny_640x360.ogv";
else if(Modernizr.video.h264)
src = "video/BigBuckBunny_640x360.mp4";
}else if(!Modernizr.video.ogg && Modernizr.video.h264){
src = "video/BigBuckBunny_640x360.mp4";
}
*/
/*
if(Modernizr.video.ogg)
src = "video/BigBuckBunny_640x360.ogv";
else if(Modernizr.video.h264)
src = "video/BigBuckBunny_640x360.mp4";
else if(!Modernizr.video.ogg && Modernizr.video.h264)
src = "video/BigBuckBunny_640x360.mp4";
*/
console.log(results);
//console.log('Video src: '+src);
var html = "";
html += '<ul>'
$.each(results, function(index, value) {
html += '<li>';
html += '<a href="'+value.url+'">';
html += 'Type: '+value.type+'<br />';
if(value.codecs!=undefined)
html += 'Codecs: '+value.codecs+'<br />';
html += 'Quality: '+value.quality;
html += '</a>';
html += '</li>';
});
html += '</ul>';
$('#promo').html(html);
});
});
</script>
</body>
</html>