4
<title>Helioviewer.org - Latest Movies</title>
5
<meta charset="utf-8" />
6
<script src="../lib/swfobject/swfobject.js"></script>
7
<style type='text/css'>
9
background-image: url('../resources/images/backgrounds/gradient_v5-optimized.png');
10
background-color: #20242F;
11
background-repeat: repeat-x;
14
#header {height: 50px;}
20
<h1 id="title">Helioviewer.org - Latest Movies</h1>
22
<div id="player"></div>
25
<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
37
action: 'getUserVideos',
40
$.post("../api/index.php", params, parseUserVideos, "json");
43
function parseUserVideos(response) {
44
var params, attrs, startURL, width, height;
46
playlist.videos = parseYoutubeVideoIds(response);
50
allowScriptAccess: "always",
51
allowfullscreen: "true"
53
attrs = {id: "moviePlayer"};
55
playlist.current_video = 0;
57
startURL = "http://www.youtube.com/v/" + playlist.videos[0] + "?" + $.param({
59
playerapiid: "ytplayer",
63
width = $(window).width() * 0.8;
64
height = $(window).height() * 0.8;
66
swfobject.embedSWF(startURL, "player", width, height, "8", "../lib/swfobject/expressinstall.swf", null, params, attrs);
71
// YouTube JavaScript Player Callbacks
72
// https://developers.google.com/youtube/js_api_reference
73
function onYouTubePlayerReady(playerId) {
74
playlist.player = document.getElementById("moviePlayer");
75
playlist.player.addEventListener("onStateChange", "onStateChange");
76
playlist.player.playVideo();
79
function onStateChange(newstate) {
84
// Re-query latest videos once we get to the end of the loop
85
if ((playlist.current_video + 1) === playlist.videos.length) {
88
action: 'getUserVideos',
92
$.post("../api/index.php", params, function(response) {
93
playlist.videos = parseYoutubeVideoIds(response);
98
// Otherwise play the next video in the queue
99
loadVideo((playlist.current_video + 1) % playlist.videos.length);
103
function loadVideo(i) {
105
playlist.current_video = i;
106
playlist.player.loadVideoById(playlist.videos[playlist.current_video], null, "highres");
109
function parseYoutubeVideoIds(response) {
112
$.each(response, function (i, video) {
113
var id = video.url.split("=").pop();
b'\\ No newline at end of file'