From adc76f0bb9602ee3494d2a225d88e06bf5ad7757 Mon Sep 17 00:00:00 2001 From: ninya9k Date: Sat, 15 May 2021 04:35:48 +0000 Subject: [PATCH] disable videojs by default --- README.md | 6 +++--- website/constants.py | 2 ++ website/routes.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1e4e643..c673ce3 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,14 @@ This works on Linux, and should work on macOS and Windows with some tweaking. Lo * Flood detection / liberal captcha * Shows stream uptime * List of users watching / not watching -* Optionally uses videojs (append `?videojs=0` to the URL to disable it) -* With videojs disabled, you can scrub backwards and forwards on the video timeline. If you scrub to the end (the most recent segment), you can achieve really quite low latency, as low as 12 seconds. +* Optionally uses videojs (append `?videojs=1` to the URL to enable it) +* With videojs disabled, you can scrub backwards and forwards on the video timeline. If you scrub to the end (the most recent segment), you can achieve really quite low latency, as low as 10 seconds. * Works without JavaScript ## Issues * CSS is spaghetti (e.g. the PureCSS framework is used sometimes when it might not need be) * AFAIK the FFmpeg command in `stream.sh` only works on Linux, change it for other OSs -* Slow: stream delay of at least 30 seconds (lower with videojs disabled). Hopefully this will decrease when congestion control gets into Tor: https://youtu.be/watch?v=zQDbfHSjbnI +* Slow: stream delay of at least 10 seconds (>30 seconds with videojs enabled). Hopefully this will decrease when congestion control gets into Tor: https://youtu.be/watch?v=zQDbfHSjbnI * Doesn't use low-latency HLS ## How it works diff --git a/website/constants.py b/website/constants.py index 32daf63..a4ccd1e 100644 --- a/website/constants.py +++ b/website/constants.py @@ -18,6 +18,8 @@ CONFIG = json.load(open(CONFIG_FILE)) BROADCASTER_TOKEN = secrets.token_hex(8) +VIDEOJS_ENABLED_BY_DEFAULT = False + HLS_TIME = 8 # seconds per segment VIEW_COUNTING_PERIOD = 30 # count views from the last x seconds CHAT_TIMEOUT = 5 # seconds between chat messages diff --git a/website/routes.py b/website/routes.py index f777acc..75bdf65 100644 --- a/website/routes.py +++ b/website/routes.py @@ -9,7 +9,7 @@ import datetime import website.chat as chat import website.viewership as viewership import website.utils.stream as stream -from website.constants import DIR_STATIC, DIR_STATIC_EXTERNAL, SEGMENT_INIT, CHAT_SCROLLBACK, BROADCASTER_COLOUR, BROADCASTER_TOKEN, SEGMENTS_DIR, VIEW_COUNTING_PERIOD, HLS_TIME, NOTES, N_NONE, MESSAGE_MAX_LENGTH +from website.constants import DIR_STATIC, DIR_STATIC_EXTERNAL, VIDEOJS_ENABLED_BY_DEFAULT, SEGMENT_INIT, CHAT_SCROLLBACK, BROADCASTER_COLOUR, BROADCASTER_TOKEN, SEGMENTS_DIR, VIEW_COUNTING_PERIOD, HLS_TIME, NOTES, N_NONE, MESSAGE_MAX_LENGTH from website.concatenate import ConcatenatedSegments, resolve_segment_offset viewers = viewership.viewers @@ -32,7 +32,7 @@ def index(token=None): viewership.video_was_corrupted.remove(token) except KeyError: pass - use_videojs = bool(request.args.get('videojs', default=1, type=int)) + use_videojs = bool(request.args.get('videojs', default=int(VIDEOJS_ENABLED_BY_DEFAULT), type=int)) viewership.made_request(token) response = render_template('index.html',