Add support for Nginx streaming (See docs)
This commit is contained in:
parent
cea9b63eca
commit
d01e418c2f
@ -320,7 +320,10 @@ def channel(id):
|
|||||||
def watch():
|
def watch():
|
||||||
id = request.args.get('v', None)
|
id = request.args.get('v', None)
|
||||||
info = ytvids.get_video_info(id)
|
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'],
|
'title':info['video']['title'],
|
||||||
'description':Markup(markupString(info['video']['description'])),
|
'description':Markup(markupString(info['video']['description'])),
|
||||||
'viewCount':info['video']['views'],
|
'viewCount':info['video']['views'],
|
||||||
@ -329,7 +332,9 @@ def watch():
|
|||||||
'channelId': info['owner']['id'],
|
'channelId': info['owner']['id'],
|
||||||
'id':id,
|
'id':id,
|
||||||
'averageRating': str((float(info['video']['rating'])/5)*100),
|
'averageRating': str((float(info['video']['rating'])/5)*100),
|
||||||
|
'nginxUrl': url,
|
||||||
'videoUrl': info['video']['url'],
|
'videoUrl': info['video']['url'],
|
||||||
|
'videoHostName': hostName,
|
||||||
'isLive': info['video']['isLive'],
|
'isLive': info['video']['isLive'],
|
||||||
'isUpcoming': info['video']['isUpcoming'],
|
'isUpcoming': info['video']['isUpcoming'],
|
||||||
'thumbnail': info['video']['thumbnail']
|
'thumbnail': info['video']['thumbnail']
|
||||||
|
@ -11,7 +11,11 @@
|
|||||||
controls
|
controls
|
||||||
buffered
|
buffered
|
||||||
preload="none">
|
preload="none">
|
||||||
<source src="{{url_for('stream', url=video.videoUrl.replace('/', 'YotterSlash'))}}" type="video/mp4">
|
{% if config.nginxVideoStream %}
|
||||||
|
<source src="{{video.nginxUrl}}" type="video/mp4">
|
||||||
|
{% else %}
|
||||||
|
<source src="{{url_for('stream', url=video.videoUrl.replace('/', 'YotterSlash'))}}" type="video/mp4">
|
||||||
|
{% endif %}
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"maxInstanceUsers": 30,
|
"maxInstanceUsers": 30,
|
||||||
"serverLocation": "Germany",
|
"serverLocation": "Germany",
|
||||||
"restrictPublicUsage":true,
|
"restrictPublicUsage":true,
|
||||||
|
"nginxVideoStream":false,
|
||||||
"maintenance_mode":false,
|
"maintenance_mode":false,
|
||||||
"show_admin_message":false,
|
"show_admin_message":false,
|
||||||
"admin_message_title":"Message from the admin",
|
"admin_message_title":"Message from the admin",
|
||||||
|
Reference in New Issue
Block a user