diff --git a/app/routes.py b/app/routes.py index ab30542..ab464e2 100644 --- a/app/routes.py +++ b/app/routes.py @@ -320,7 +320,10 @@ def channel(id): def watch(): id = request.args.get('v', None) info = ytvids.get_video_info(id) - video = { + hostName = urllib.parse.urlparse(info['video']['url']).netloc + # Use nginx + url = info['video']['url'].replace(hostName, "yotter.xyz")+"&hostname="+hostName + video={ 'title':info['video']['title'], 'description':Markup(markupString(info['video']['description'])), 'viewCount':info['video']['views'], @@ -329,7 +332,9 @@ def watch(): 'channelId': info['owner']['id'], 'id':id, 'averageRating': str((float(info['video']['rating'])/5)*100), + 'nginxUrl': url, 'videoUrl': info['video']['url'], + 'videoHostName': hostName, 'isLive': info['video']['isLive'], 'isUpcoming': info['video']['isUpcoming'], 'thumbnail': info['video']['thumbnail'] diff --git a/app/templates/video.html b/app/templates/video.html index 95fe7aa..25183ab 100644 --- a/app/templates/video.html +++ b/app/templates/video.html @@ -11,7 +11,11 @@ controls buffered preload="none"> - + {% if config.nginxVideoStream %} + + {% else %} + + {% endif %} diff --git a/yotter-config.json b/yotter-config.json index 04e7578..434d077 100644 --- a/yotter-config.json +++ b/yotter-config.json @@ -4,6 +4,7 @@ "maxInstanceUsers": 30, "serverLocation": "Germany", "restrictPublicUsage":true, + "nginxVideoStream":false, "maintenance_mode":false, "show_admin_message":false, "admin_message_title":"Message from the admin",