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
|
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Elevate Festival 2018 - Live Stream</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta property="og:site_name" content="Elevate Festival">
<meta property="og:title" content="Livestream">
<meta property="og:image:url" content="https://stream.elevate.at/2018/images/mediachannel.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:type" content="image/jpg">
<meta property="og:type" content="article">
</head>
<body>
<h1>Elevate Festival 2018 - Live Stream</h1>
<div class="center">
<table id="header">
<tr>
<td class="sources" align='left' width='20%'>
<!-- sources -->
</td>
<td class="modes" align='center' width='33%'>
<!-- modes -->
</td>
<td class="profiles" align='right' width='47%'>
<!-- profiles -->
</td>
</tr>
</table>
<div id="video-container-outer">
<div id="video-overlay" style="position: absolute; background-color: rgba(255,255,255,0.5);" >
<div id="video-overlay-inner">
</div>
</div>
<video id="video" style="display: block";>
<!-- video sources -->
</video>
<audio id="audio">
<!-- audio sources -->
</audio>
<div class="turm"></div>
</div>
<div id="player" style="display:block;"></div>
<div id="controls">
<table width="100%">
<tr>
<td valign="center" width="22px">
<div id="player-state"></div>
</td>
<td valign="center" align="right">
<input type="range" id="player-volume" min="0" max="100" value="100">
<div id="player-mute"></div>
</td>
<td valign="center" width="22px">
<a id="fullscreen"><img src="images/fullscreen.png" /></a>
</td>
</tr>
</table>
</div>
<table id="footer">
<tr>
<td align='right'>
<h2>Direct Link(s):</h2>
</td>
<td class="direct-links" align='left'>
</td>
</tr>
</table>
<table id="logos">
<tr>
<td><a href="http://okto.tv"><img src="images/sponsors/okto.png" /></a></td>
<td><a href="https://dorftv.at"><img src="images/sponsors/dorfTV.png" /></a></td>
<td><a href="http://helsinki.at"><img src="images/sponsors/helsinki.png" /></a></td>
<td> </td>
<td><a href="http://citycom-austria.com"><img src="images/sponsors/citycom.png" /></a></td>
</tr>
</table>
</div>
<h3><a href="https://www.elevate.at">zurück zur Elevate Website</a></h3>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/flowplayer/flowplayer-3.2.6.min.js"></script>
<script type="text/javascript" src="js/player.js"></script>
<script type="text/javascript" src="js/parseLocationHref.js"></script>
<script type="text/javascript" src="https://stream.elevate.at/js/config.js"></script>
<script>
var Model = function(config, uri) {
this.config = config;
// todo: get defaults from config.js? or window width, browser functions etc.?
var defaultParameters = {
src: 'av-orig',
mode: 'webm',
profile: 'medium',
embed: false
};
if (navigator.appName == 'Microsoft Internet Explorer' ||
!!(navigator.userAgent.match(/Trident/) ||
navigator.userAgent.match(/rv:11/))) {
defaultParameters.mode = 'flash';
}
this.baseUrl = uri.scheme + '://' + uri.servername;
this.path = uri.path.join('/');
this.parameters = {};
for (var index in defaultParameters) {
this.parameters[index] = defaultParameters[index];
}
for (var index in uri.parameters) {
this.parameters[index] = uri.parameters[index];
}
var modes = this.getModes();
if (modes.indexOf(this.parameters.mode) === -1) {
if (modes.indexOf(defaultParameters.mode) !== -1) {
this.parameters.mode = defaultParameters.mode;
} else {
this.parameters.mode = modes[0];
}
}
var profiles = this.getProfiles();
if (profiles.indexOf(this.parameters.profile) === -1) {
if (profiles.indexOf(defaultParameters.profile) !== -1) {
this.parameters.profile = defaultParameters.profile;
} else {
this.parameters.profile = profiles[0];
}
}
};
Model.prototype.getSources = function () {
return Object.keys(this.config.muxes);
};
Model.prototype.getModes = function (source) {
source = source || this.parameters.src;
return Object.keys(this.config.muxes[source].formats);
};
Model.prototype.hasVideo = function (source) {
source = source || this.parameters.src;
return this.config.muxes[source].hasOwnProperty('video');
};
Model.prototype.getProfiles = function (source, mode) {
source = source || this.parameters.src;
mode = mode || this.parameters.mode;
return this.config.muxes[source].formats[mode];
};
Model.prototype.getResolution = function (profile) {
profile = profile || this.parameters.profile;
var video = this.config.profiles[profile].video;
return this.config.resolutions[video];
};
Model.prototype.getUrl = function (change) {
change = change || {};
var parameters = Object.assign({}, this.parameters); // copy
for (var index in change) {
parameters[index] = change[index];
}
var parametersTmp = [];
for (var index in parameters) {
if (parameters[index] === null || parameters[index] === false) {
continue;
}
parametersTmp.push(index + '=' + parameters[index]);
}
return this.baseUrl + '/' + this.path + '?' + parametersTmp.join('&');
};
Model.prototype.getStreamUrl = function (thing) {
var url = this.config.streamBaseUrl + '/';
switch(thing) {
case 'webm':
url += this.parameters.src + '-webm-' +
this.parameters.profile + '.webm';
break;
case 'hls':
url += 'hls/' + this.parameters.src + '-' +
this.parameters.profile + '/index.m3u8';
break;
case 'flash':
url += this.parameters.src + '-flash-' +
this.parameters.profile + '.flv';
break;
case 'ogg':
url += this.parameters.src + '-ogg-' +
this.parameters.profile + '.ogg';
break;
case 'mp3':
url += this.parameters.src + '-mp3-' +
this.parameters.profile + '.mp3';
break;
}
return url + '?nocache=' + Date.now();
};
function setResolutions(res) {
$('#header').css('width', res.width);
$('#video-container-outer').css('width', res.width).css('height', res.height);
$('#video-overlay').css('width', res.width).css('height', res.height);
$('#player').css('width', res.width).css('height', res.height);
$('#controls').css('width', res.width);
$('#logos').css('width', res.width);
$('#footer').css('width', res.width);
}
function setHeaderMenu(type, currentItem, items, $element) {
var labels = {
'av-orig': 'video',
'audio-orig': 'audio-only',
'webm': 'html5'
};
items.map(function(item) {
var urlParameters = {};
urlParameters[type] = item;
if (type === 'src') {
urlParameters.mode = null;
}
var itemLabel = labels[item] || item;
var $span = $('<span><a href="' + model.getUrl(urlParameters) + '">' + itemLabel + '</a></span>');
if (item === currentItem) {
$span.addClass('selected');
}
$element.append($span);
});
}
function setHtml5VideoSources(model) {
$('#audio').hide();
$('.turm').hide();
$('#video').append('<source src="' + model.getStreamUrl('webm') + '" type="video/webm" />')
.append('<source src="' + model.getStreamUrl('hls') + '" type="application/x-mpegURL" />')
.show();
}
function setAudioSources(model) {
$('#video').hide();
$('#fullscreen').hide();
$('#audio').append('<source src="' + model.getStreamUrl('ogg') + '" type="audio/ogg" />')
.append('<source src="' + model.getStreamUrl('mp3') + '" type="audio/mpeg" />')
.show();
}
function initFlowplayer(model) {
flowplayer("player", "js/flowplayer/flowplayer-3.2.7.swf", {
clip: {
url: model.getStreamUrl('flash'),
autoPlay: true,
autoBuffering: true,
bufferLength: 5,
live: true,
scaling: "fit"
},
plugins: {
controls: {
url: "js/flowplayer/flowplayer.controls-3.2.5.swf",
time: false,
}
}
} );
}
function selectPlayer(model) {
if (model.parameters.mode === 'flash') {
$('#video-container-outer').hide();
initFlowplayer(model);
} else {
$('#player').hide();
if (model.hasVideo()) {
setHtml5VideoSources(model);
} else {
setAudioSources(model);
}
player_init(model.hasVideo());
}
}
function setDirectLinks(model) {
$('#footer .direct-links')
.append('<a href="' + model.getStreamUrl('webm') + '">' + model.getStreamUrl('webm') + '</a><br />')
.append('<a href="' + model.getStreamUrl('hls') + '">' + model.getStreamUrl('hls') + '</a><br />')
.append('<a href="' + model.getStreamUrl('flash') + '">' + model.getStreamUrl('flash') + '</a><br />')
.append('<a href="' + model.getStreamUrl('ogg') + '">' + model.getStreamUrl('ogg') + '</a><br />')
.append('<a href="' + model.getStreamUrl('mp3') + '">' + model.getStreamUrl('mp3') + '</a><br />');
}
var uri = parseLocationHref();
var model = new Model(config, uri);
$(function () {
setResolutions(model.getResolution());
setHeaderMenu('src', model.parameters.src, model.getSources(), $('#header .sources'));
setHeaderMenu('mode', model.parameters.mode, model.getModes(), $('#header .modes'));
// todo: if embed set links to target='_parent'
setHeaderMenu('profile', model.parameters.profile, model.getProfiles(), $('#header .profiles'));
selectPlayer(model);
setDirectLinks(model);
// todo: hide controls, hide links, embed...
});
</script>
</body>
</html>
|