This is the code for the streaming website at streaming.media.ccc.de, which is used by the C3VOC to stream live video and audio from various conferences on the Internet. present. The idea behind this project is to have a generic codebase that can be used that can be adapted to the conference with a few configuration options and a few CSS rules. conditions and the design of the conference.
During development the built-in PHP web server can be used: ``sh $ ./serve.sh PHP 7.0.4-7ubuntu2.1 Development Server started at Mon Jun 20 22:40:17 2016 Listening on http://localhost:8000 Document root is /home/peter/VOC/streaming-website Press Ctrl-C to quit. ...
PHP 5.4 and higher is supported.
### Docker
If you prefer Docker, you can also use the following line:
```sh
docker run -it -p 8000:8000 -v "$PWD":/app -w /app php:7-cli -S 0.0.0.0:8000 -d short_open_tag=true index.php
apt install php7.0-curl php7.0-xml
# - or -
apt install php-curl php-xml
./download.sh
The page can be used for several conferences running in parallel at the same time. at the same time. Each conference is configured via a folder underneath configs/conferences. In these folders you can files that determine the behavior and layout of the conference page. of the respective conference page, in the following at :
- config.php - controls the behavior of the entire conference page. This is extensively documented and should be self-explanatory.
- main.less - controls the layout of the conference page.
- other assets like
.png
or.svg
files that can be referenced from withinmain.less
.
See also https://c3voc.de/wiki/software:streamingwebsite#add_a_new_conference
The setup at the VOC consists of a hidden master server, which executes the PHP code
in a nginx. Behind it come n
frontend caches, where for small
events n
is almost always =1
. For large events (camp, congress)
we can easily deploy additional frontend caches at different hosters.
hosters.
For the preparation of a conference or for the further development of the page it is helpful to set up the part locally. The easiest way to do this is with an Apache, because the enclosed .htaccess configures the URL rewriting correctly. With nginx this has to be set in the global nginx.conf like this:
location / {
rewrite /(.*) /index.php?route=$1 last;
}
Differing from the default config, the flag short_open_tag = On
must be set in PHP.
must be set.
see deploy.sh resp. https://c3voc.de/wiki/software:streamingwebsite
Under the URL http://streaming.media.ccc.de/streams/v2.json the streaming website provides an overview of all configured rooms and streams in a machine-readable in a machine-readable format. This can be used, e.g., to be used in the various applications that have developed around the conference event, offer players and links to live broadcasts.
As the URL suggests, the API is versioned. This means that in
fields in the v2.json
are removed or change their meaning - but there may be
but new fields may be added. A more formal specification
of the JSON format is tbd. An example can be viewed here
viewed.
- Kodi media.ccc.de plugin
- re-data
- Scraping code: https://github.com/ocdata/re-data/blob/feature/34c3/scraper/34C3/scraper.js
- During events data appears here: http://api.conference.bits.io/
If serve.sh
throws an error like PHP Fatal error: Uncaught ErrorException: Required parameter $rules follows optional parameter $value in /<path-to-repository>/lib/less.php/Less.php:5501
it could be that you are using the wrong PHP version. If php --version
returns 8 or newer, then your version is too new. Try to install PHP 7.4 on your operating system and change the version in the scripts you need. For example
``sh
php -S localhost:$port -d short_open_tag=true index.php
then
```sh
# after
php7.4 -S localhost:$port -d short_open_tag=true index.php
If you only see a blank page when you call the page in your browser, look in your terminal to see if there was an error. If you see an error like PHP Fatal error: Uncaught Error: Call to undefined function iconv()
, the iconv-extention is not activated. You can enable it in your global php.ini
. You can find out where this file is with php --ini
or php7 --ini
. Search the file for the right line and remove the semicolon at the beginning. If there is no semicolon, the extension should already be activated.
// before
;extension=iconv
// after
extension=iconv
If you get the error lessc: command not found
when running scripts, you are missing a less compiler. There are several ways to install a less compiler. For example, if you are using npm
, you can install less globally with npm install -g less
. Then lessc
should be globally available on your system.
Translated with www.DeepL.com/Translator (free version)
Dies ist der Code für die Streaming-Webseite unter streaming.media.ccc.de, welche vom C3VOC benutzt wird, um Live-Video- und -Audio-Streams von diversen Konferenzen im Internet zu präsentieren. Die Idee hinter diesem Projekt ist es, eine generische Codebasis zu haben, die mit wenigen Konfigurationsoptionen und ein paar CSS-Rules an die Gegebenheiten und die Gestaltung der Konferenz angepasst werden können.
Während der Entwicklung kann der eingebaute PHP-Webserver verwendet werden:
$ ./serve.sh
PHP 7.0.4-7ubuntu2.1 Development Server started at Mon Jun 20 22:40:17 2016
Listening on http://localhost:8000
Document root is /home/peter/VOC/streaming-website
Press Ctrl-C to quit.
…
Unterstützt wird PHP ab 5.4.
Wer lieber Docker mag, kann auch folgende Zeile verwenden:
docker run -it -p 8000:8000 -v "$PWD":/app -w /app php:7-cli -S 0.0.0.0:8000 -d short_open_tag=true index.php
apt install php7.0-curl php7.0-xml
# - or -
apt install php-curl php-xml
./download.sh
Die Seite kann für mehrere parallel laufende Konferenzen gleichzeitig verwendet werden. Jede Konferenz wird über einen Ordner unterhalb von configs/conferences konfiguriert. In diesen Ordnern können jeweils folgende Dateien abgelegt werden, welche das Verhalten bzw. die Gestaltung der jeweiligen Konferenzseite bestimmen, im Folgendem am :
- config.php – steuert das Verhalten der gesamten Konferenzseite. Diese ist ausführlich dokumentiert und sollte sich selbst erklären.
- main.less – steuert die Gestaltung der Konferenzseite.
- weitere Assets wie
.png
oder.svg
-Dateien, die aus dermain.less
heraus referenziert werden können.
Siehe auch https://c3voc.de/wiki/software:streamingwebsite#add_a_new_conference
Das Setup beim VOC besteht aus einem Hidden-Master-Server, welcher den PHP-Code
in einem nginx ausführt. Dahinter kommen n
Frontend-Caches, wobei für kleine
Events n
eigentlich fast immer =1
ist. Für große Events (Camp, Congress)
können wir aber sehr einfach weitere Frontend-Caches bei verschiedenen Hostern
hinzu deployen.
Zur Vorbereitung einer Konferenz oder zur Weiterentwickelung der Seite ist es hilfreich, sich das Teil lokal aufzusetzen. Am einfachsten geht das mit 'nem Apachen, denn die beiliegende .htaccess konfiguriert das URL-Rewriting gleich richtig. Bei nginx muss das in der globalen nginx.conf ungefähr so eingestellt werden:
location / {
rewrite /(.*) /index.php?route=$1 last;
}
Abweichend von der Default-Config muss in PHP das Flag short_open_tag = On
gesetzt werden.
see deploy.sh bzw. https://c3voc.de/wiki/software:streamingwebsite
Unter der URL http://streaming.media.ccc.de/streams/v2.json bietet die Streaming-Webseite eine Übersicht über alle konfigurierten Räume und Streams in einem maschinenlesbaren Format an. Dieses kann z.B. genutzt werden, um in den diversen Anwendungen, die sich rund um das Konferenzgeschehen entwickelt haben, Player und Links zu Liveübertragungen anzubieten.
Wie die URL vermuten lässt, ist die API versioniert. Dies bedeutet, dass in
der v2.json
keine Felder entfernt werden oder ihre Bedeutung ändern – es
können aber durchaus neue Felder hinzukommen. Eine formalere Spezifikation
des JSON-Formats ist tbd. Ein Beispiel kann hier
betrachtet werden.
- Kodi media.ccc.de Plugin
- re-data
- Scraping code: https://github.com/ocdata/re-data/blob/feature/34c3/scraper/34C3/scraper.js
- During events data appears here: http://api.conference.bits.io/
Wenn serve.sh
einen Fehler wirft wie z.B. PHP Fatal error: Uncaught ErrorException: Required parameter $rules follows optional parameter $value in /<path-to-repository>/lib/less.php/Less.php:5501
kann es sein, dass du eine falsche PHP-Version verwendest. Wenn php --version
8 oder neuer zurückgibt, dann ist deine Version zu neu. Versuche auf deinem Betriebssystem PHP 7.4 zu installieren und in den Skripts, die zu benötigst, die Version anzupassen. Zum Beispiel wird dann aus
# vorher
php -S localhost:$port -d short_open_tag=true index.php
dann
# nachher
php7.4 -S localhost:$port -d short_open_tag=true index.php
Wenn du beim Aufrufen der Seite im Browser nur eine leere Seite siehst, schau in dein Terminal, ob es einen Fehler gab. Wenn du einen Fehler wie PHP Fatal error: Uncaught Error: Call to undefined function iconv()
siehst, ist bei dir die iconv-Extention nicht aktiviert. Du kannst diese in deiner globalen php.ini
aktivieren. Wo diese Datei liegt kannst du mit php --ini
bzw. php7 --ini
rausfinden. Suche in der Datei nach der richtigen Zeile und entferne das Semikolon am Anfang. Wenn es kein Semikolon gibt, sollte die Extension bereits aktiviert sein.
// vorher
;extension=iconv
// nachher
extension=iconv
Wenn du beim Ausführen von Skripten den Fehler lessc: command not found
bekommst, fehlt dir ein less-Compiler. Es gibt verschiedene Arten, sich einen less-Compiler zu installieren. Falls du npm
verwendest, kannst du beispielsweise less global installieren mit npm install -g less
. Anschließen sollte lessc
dann global auf deinem System verfügbar sein.