Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented basic version that gets data from youtube directly
- Loading branch information
1 parent
f0707bb
commit 5004a46
Showing
8 changed files
with
190 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#!/usr/bin/perl | ||
use strictures; | ||
|
||
package scenefinity; | ||
|
||
use Web::Scenefinity; | ||
Web::Scenefinity->run_if_script; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Scenefinity - an endless, randomized stream of demos</title> | ||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js"></script> | ||
<script type="text/javascript" src="/youtube.js" ></script> | ||
<link rel="shortcut icon" type="image/x-icon" href="http://perl-tutorial.org/favicon.ico"> | ||
|
||
<style type="text/css"> | ||
body { | ||
font-family: Tahoma, sans-serif; | ||
color: #eee; | ||
background: #1A1A1A; | ||
text-align: center; | ||
margin: auto; | ||
width: 40em; | ||
} | ||
a { | ||
color: #fff; | ||
} | ||
.subtitle { | ||
font-size: 0.5em; | ||
color: #999; | ||
} | ||
h1 { | ||
line-height: 1em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1> | ||
Scenefinity<br /> | ||
<span class="subtitle">an endless, randomized stream of demos</span> | ||
</h1> | ||
|
||
<div style="width: 40em;height:30em;"> | ||
<span id="ytapiplayer">You need Flash player 8+ and Javascript enabled to view videos.</div> | ||
<script type="text/javascript"> | ||
var flashvars = {}; | ||
var params = {}; | ||
params.wmode = "transparent"; | ||
params.AllowScriptAccess = "always"; | ||
params.allowfullscreen = "true"; | ||
var attributes = { id: "playerid" }; | ||
swfobject.embedSWF( | ||
"http://www.youtube.com/v/svGk_pF67gc?fs=1&playerapiid=playerid&enablejsapi=1&rel=0", | ||
"ytapiplayer", | ||
"100%", | ||
"100%", | ||
"8", | ||
"false", | ||
flashvars, | ||
params, | ||
attributes | ||
); | ||
</script> | ||
</div> | ||
<a href="javascript:play_next_video();" style="font-size:2em">next demo</a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var player; | ||
var default_id = "svGk_pF67gc"; | ||
var playlist = []; | ||
var current_id; | ||
var playlist_is_updating; | ||
|
||
function onYouTubePlayerReady(player_id) { | ||
player = document.getElementById(player_id); | ||
player.addEventListener("onStateChange", "on_yt_state_change"); | ||
update_playlist(); | ||
} | ||
|
||
function on_yt_state_change(new_state) { | ||
if (new_state != 0) return; | ||
play_next_video(); | ||
} | ||
|
||
function play_next_video() { | ||
var next_id = playlist.shift(); | ||
if (!next_id) next_id = default_id; | ||
player.loadVideoById(next_id); | ||
update_playlist(); | ||
} | ||
|
||
function update_playlist() { | ||
if (playlist.length > 5) return; | ||
if (playlist_is_updating) return; | ||
|
||
playlist_is_updating = 1; | ||
|
||
$.get('/more_demos', function(data) { | ||
playlist = playlist.concat(data); | ||
playlist_is_updating = 0; | ||
}, "json").error(function(jqXHR, textStatus, errorThrown) { | ||
alert(textStatus + " : " + errorThrown + " :\n" + jqXHR.responseText); | ||
playlist_is_updating = 0; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,6 @@ done_testing; | |
exit; | ||
|
||
sub run { | ||
|
||
ok( 1, "loads" ); | ||
return; | ||
} |