-
Notifications
You must be signed in to change notification settings - Fork 0
/
side_by_side.rhtml
124 lines (102 loc) · 3.3 KB
/
side_by_side.rhtml
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Side by side compression comparison</title>
<script src="swfobject.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
var player1 = null;
var player2 = null;
var currentPosition = 0;
function createPlayer(thePlaceholder, thePlayerId, theFile, theAutostart) {
var flashvars = {
file:theFile,
autostart:theAutostart,
// playlistsize:"150",
// playlist:"bottom"
}
var params = {
allowfullscreen:"true",
allowscriptaccess:"always"
}
var attributes = {
id:thePlayerId,
name:thePlayerId
}
swfobject.embedSWF("player.swf", thePlaceholder, "864", "480", "9.0.115", false, flashvars, params, attributes);
}
function init() {
createPlayer("placeholder1", "player1", "../output/1/0.mp4", false);
createPlayer("placeholder2", "player2", "../output/1/1.mp4", false);
}
function playerReady(thePlayer) {
if (thePlayer.id == 'player1') {
player1 = window.document[thePlayer.id];
player1.addModelListener("TIME", "positionListener");
} else if (thePlayer.id == 'player2')
player2 = window.document[thePlayer.id];
};
function loadPlaylists(){
var playlist = [
<% @@results.each do |r| %>
{'file': '<%= r.filename %>', 'title':'<%= r.filename %>'},
<% end %>
]
player1.sendEvent('LOAD', playlist);
player2.sendEvent('LOAD', playlist);
}
function scrubAhead(){
currentPosition += 1;
player1.sendEvent('SEEK', currentPosition);
player1.sendEvent('PLAY');
player2.sendEvent('SEEK', currentPosition);
player2.sendEvent('PLAY');
}
function loadFile(filename, playerId){
window.document[playerId].sendEvent('LOAD', filename)
}
function positionListener(obj) {
currentPosition = obj.position;
}
</script>
</head>
<body onload="init();">
<table><tr><td>
<div id="wrapper1">
<div id="placeholder1"></div>
</div>
</td></tr>
<tr><td>
<div id="wrapper2">
<div id="placeholder2"></div>
</div>
</td></tr></table>
<P>
<table border=1>
<% @@results.each do |r| %>
<tr><td width = 500><%= r.id %> (<%= r.format %>): <%= r.size %>MB, <%= r.time %>s (<%= r.flags %>) </td>
<td><a href="javascript:loadFile('<%= r.filename %>', 'player1')"> X </a></td>
<td><a href="javascript:loadFile('<%= r.filename %>', 'player2')"> X </a></td>
</tr>
<% end %>
</table>
<P>
<ul>
<li><a href="javascript:loadPlaylists()">Load playlists</a>.</li>
<li><a href="javascript:scrubAhead()">Scrub 30 Seconds forward</a>.</li>
</ul>
<script type="text/javascript" charset="utf-8">
urchinTracker = function(path) {
if (typeof(console) != 'undefined') {
console.info("urchinTracker call: " + path);
}
}
</script>
<P>
SETUP:<BR>
1) ln -nfs /Users/stephenclifton/code/compression_tests /Library/WebServer/Documents/compression <BR>
2) apachectl start<BR>
3) open http://localhost/compression/output/side_by_side.html<BR>
</body>
</html>