ese webite

This commit is contained in:
revol-xut 2022-09-28 14:20:08 +02:00
parent 242e2450d3
commit a9aed45166
No known key found for this signature in database
GPG key ID: 4F56FF7759627D07
14 changed files with 247 additions and 1 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,138 @@
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="bootstrap.min.js"></script>
<script type="text/javascript" src="clappr.min.js"></script>
<script type="text/javascript" src="level-selector.min.js"></script>
<title>ESE 2021 Livestream</title>
</head>
<body>
<!-- Navbar -->
<nav class="navbar fixed-top navbar-dark bg-primary">
<a class="navbar-brand" href="#">ESE 2021 Livestream</a>
<span class="navbar-text mr-auto" id="streamtitle"></span>
<button class="btn btn-secondary" type="button" data-toggle="modal" data-target="#infoModal">Ext. Player/Audio Only</button>
</nav>
<!-- The player will be in here -->
<div class="container-fluid fill">
<div id="player"></div>
</div>
<!-- Info Dialog -->
<div class="modal fade" id="infoModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Externe Player und Nur-Audio-Stream</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<h4>Videostream im externen Player</h4>
<p>Um diesen Stream in VLC zu öffnen, nutze die folgende Netzwerkadresse:</p>
<p><code id="urlStream">unset</code></p>
<h4>Nur-Audio-Stream</h4>
<audio id="audioPlayer" controls>
</audio>
<p>Um den Audiostream in VLC zu öffnen, nutze die folgende Netzwerkadresse:</p>
<p><code id="urlAudio">unset</code></p>
</div>
</div>
</div>
</div>
<!-- Player and other script stuff -->
<script>
var urlParams = new URLSearchParams(window.location.search);
var streamName = "stream/main";
var availableMirrors = ['bei.ese', 'nan.ese'];
var mirror;
if(urlParams.get('mirror')){
mirror = urlParams.get('mirror')
}
else{
mirror = availableMirrors[Math.floor(Math.random() * availableMirrors.length)];
}
var targetPlayerElement = "#player";
var posterImage = "poster.png";
var offlineContent = "<div class='offlineImg'></div>";
var streamURL = 'https://' + mirror + '.ifsr.de/' + streamName + '.m3u8';
var audioURL = 'https://' + mirror + '.ifsr.de/' + streamName;
var isLive = false;
$('#streamtitle').html('#' + streamName + ' (Mirror: ' + mirror + ')');
$('#urlStream').html(streamURL);
$('#urlAudio').html(audioURL);
$('#audioPlayer').html('<source src="' + audioURL + '" type="audio/mpeg">');
function getClapprPlayer() {
return new Clappr.Player({
source: streamURL,
autoPlay: true,
mute: true,
parentId: targetPlayerElement,
width: "100%",
height: "100%",
poster: posterImage,
mediacontrol: {seekbar: "#4a7aac", buttons: "#4a7aac"},
hlsMinimumDvrSize: 0,
hlsjsConfig: {
liveSyncDurationCount: 2
},
plugins: [LevelSelector],
levelSelectorConfig: {
title: 'Quality',
labels: {
1: 'High',
0: 'Low',
}
}
});
}
function checkLive() {
var player;
console.log("Checking stream status...");
$.ajax({
url: streamURL, //stream url
success: function(data){
if(!isLive)
{
$(targetPlayerElement).empty();
isLive = true;
player = getClapprPlayer();
console.log("Stream is running; creating player");
}
},
error: function(data){
if(isLive)
{
isLive = false;
$(targetPlayerElement).empty();
$(targetPlayerElement).html(offlineContent);
}
if(!isLive)
$(targetPlayerElement).html(offlineContent);
},
})
setTimeout(checkLive, 10000);
}
checkLive();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

View file

@ -0,0 +1,20 @@
html, body {
height: 100%;
}
.fill {
padding-left: 0;
padding-right: 0;
padding-top: 70px;
min-height: 100%;
height: 100%;
}
.offlineImg {
height: 100%;
width: 100%;
background-position: center center;
background-repeat: no-repeat;
background-image: url("poster_offline.png");
background-color: #474747;
}

View file

@ -0,0 +1,3 @@
- name: restart nginx
service: name=nginx state=restarted

View file

@ -0,0 +1,17 @@
- name: require nginx
include_role:
name: nginx
- name: apply nginx config template to /etc/nginx/conf.d/stream_frontend.conf
template:
src: stream_frontend.conf.j2
dest: /etc/nginx/conf.d/stream_frontend.conf
notify: restart nginx
- name: copy streaming website
copy:
src: "{{ item }}"
dest: "/var/www/{{ stream_frontend_nginx_url }}/"
owner: www-data
with_fileglob:
- "website/*"

View file

@ -0,0 +1,45 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name {{ stream_frontend_nginx_url }} stream.ese.ifsr.de;
# Some systems require you to actually create this directory before starting nginx.
# If this is the case on your system, you may need to move it outside `/tmp` and create the directory manually (not forgetting to give ownership
# to www-data with chown).
# Thanks to @joe for pointing this out in a comment!
client_body_temp_path /tmp/nginx-client-bodies;
client_max_body_size 0;
create_full_put_path on;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Expose-Headers Content-Length;
add_header Access-Control-Allow-Headers Range;
root /var/www/{{ stream_frontend_nginx_url }}/;
ssl_certificate /data/fullchain.pem; # managed by Certbot
ssl_certificate_key /data/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = {{ stream_frontend_nginx_url }}) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = stream.ese.ifsr.de) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name {{ stream_frontend_nginx_url }} stream.ese.ifsr.de;
return 404; # managed by Certbot
}

View file

@ -13,7 +13,7 @@ in {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {
root = "${website}/roles/stream_frontend/"; root = "${../content/ese-stream/files/website}/";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };