From a666c01300b1031c01b3e8020b80f4792e613858 Mon Sep 17 00:00:00 2001 From: nicco Date: Fri, 29 Jun 2018 12:30:49 +0200 Subject: [PATCH] video streaming --- Dockerfile => video/Dockerfile | 0 video/README.md | 27 +++++++++ .../docker-compose.yml | 0 nginx.conf => video/nginx.conf | 0 {srv => video/srv}/index.html | 0 {srv => video/srv}/shaka.js | 0 video/time/fittext.js | 50 ++++++++++++++++ video/time/time.html | 59 +++++++++++++++++++ 8 files changed, 136 insertions(+) rename Dockerfile => video/Dockerfile (100%) create mode 100644 video/README.md rename docker-compose.yml => video/docker-compose.yml (100%) rename nginx.conf => video/nginx.conf (100%) rename {srv => video/srv}/index.html (100%) rename {srv => video/srv}/shaka.js (100%) create mode 100644 video/time/fittext.js create mode 100644 video/time/time.html diff --git a/Dockerfile b/video/Dockerfile similarity index 100% rename from Dockerfile rename to video/Dockerfile diff --git a/video/README.md b/video/README.md new file mode 100644 index 0000000..293681d --- /dev/null +++ b/video/README.md @@ -0,0 +1,27 @@ +# Livestream + +Dockerized livestream server based on nginx that serves HLS and DASH. + +## Quickstart 💥 + +``` +docker-compose up -d +``` + +## Setup 🏗 + +Tweak `nginx.conf` to your likings if necessary. + +## Usage 👾 + +Stream to it with [OBS](https://obsproject.com/) + +Settings -> Stream: + - Stream Type = custom + - Url = rtmp://localhost/mychannel + - Stream Key = some *non empty* string + +Settings -> Output: + - Output Mode = Simple + - Streaming + - Bitrate = depends on resolution and quality. check [here](https://support.video.ibm.com/hc/en-us/articles/207852117-Internet-connection-and-recommended-encoding-settings) \ No newline at end of file diff --git a/docker-compose.yml b/video/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to video/docker-compose.yml diff --git a/nginx.conf b/video/nginx.conf similarity index 100% rename from nginx.conf rename to video/nginx.conf diff --git a/srv/index.html b/video/srv/index.html similarity index 100% rename from srv/index.html rename to video/srv/index.html diff --git a/srv/shaka.js b/video/srv/shaka.js similarity index 100% rename from srv/shaka.js rename to video/srv/shaka.js diff --git a/video/time/fittext.js b/video/time/fittext.js new file mode 100644 index 0000000..1cc7ea7 --- /dev/null +++ b/video/time/fittext.js @@ -0,0 +1,50 @@ +/*global jQuery */ +/*! + * FitText.js 1.2 + * + * Copyright 2011, Dave Rupert http://daverupert.com + * Released under the WTFPL license + * http://sam.zoy.org/wtfpl/ + * Modified by Niccolo Borgioli github.com/cupcakearmy + * + * Date: Thu May 05 14:23:00 2011 -0600 + */ + +((window) => { + window.fittext = (element, kompressor, options) => { + + const compressor = kompressor || 1, + settings = Object.assign({ + 'minFontSize': Number.NEGATIVE_INFINITY, + 'maxFontSize': Number.POSITIVE_INFINITY + }, options) + + const resizer = () => element.style.fontSize = `${Math.max(Math.min(element.offsetWidth / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize))}px` + + resizer() + window.addEventListener('resize', resizer) + + } + + window.textfill = (element, options) => { + const ourText = element.querySelector('span'); + const maxHeight = element.offsetHeight; + const maxWidth = element.offsetWidth; + + + + let fontSize = Number.POSITIVE_INFINITY; + let textHeight; + let textWidth; + + const resizer = () => { + do { + ourText.style.fontSize = `${fontSize}px` + textHeight = ourText.offsetHeight + textWidth = ourText.offsetWidth + fontSize = fontSize - 1 + } while ((textHeight > maxHeight || textWidth > maxWidth) && fontSize > 3) + } + resizer() + } +})(window) \ No newline at end of file diff --git a/video/time/time.html b/video/time/time.html new file mode 100644 index 0000000..a7bbeff --- /dev/null +++ b/video/time/time.html @@ -0,0 +1,59 @@ + + + + + + + + + +
+ + Test + +
+ + + + + + + \ No newline at end of file