Use Video.js player
This commit is contained in:
parent
382c8cb981
commit
cc588e7108
@ -320,7 +320,6 @@ def video(id):
|
||||
'author':data['uploader'],
|
||||
'authorUrl':data['uploader_url'],
|
||||
'id':id,
|
||||
'url': data['formats'][-1]['url'],
|
||||
'averageRating': str((float(data['average_rating'])/5)*100)
|
||||
}
|
||||
return render_template("video.html", video=video)
|
||||
@ -330,8 +329,8 @@ def video(id):
|
||||
def watch(id):
|
||||
ydl = YoutubeDL()
|
||||
data = ydl.extract_info("{id}".format(id=id), download=False)
|
||||
req = requests.get(data['formats'][-1]['url'], stream = True)
|
||||
return Response(stream_with_context(req.iter_content(chunk_size=1024)), content_type = req.headers['content-type'])
|
||||
req = requests.get(data['formats'][-2]['url'], stream = True)
|
||||
return Response(stream_with_context(req.iter_content(chunk_size=4096)), content_type = req.headers['content-type'])
|
||||
|
||||
|
||||
#########################
|
||||
|
1663
app/static/videojs.css
Normal file
1663
app/static/videojs.css
Normal file
File diff suppressed because one or more lines are too long
58346
app/static/videojs.js
Normal file
58346
app/static/videojs.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,7 @@
|
||||
{% endif %}
|
||||
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='semantic/semantic.min.css') }}">
|
||||
<link rel="stylesheet" type= "text/css" href="{{ url_for('static',filename='styles.css') }}">
|
||||
<link rel="stylesheet" type= "text/css" href="{{ url_for('static',filename='videojs.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="ui stackable menu">
|
||||
@ -48,6 +49,7 @@
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
|
||||
|
||||
<script src="{{ url_for('static',filename='videojs.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
{% block content %}
|
||||
<div style="margin-top: 2em;" class="ui one column centered grid">
|
||||
<video width="720" height="480" controls>
|
||||
<video class="video-js vjs-default-skin" controls data-setup='{ "playbackRates": [0.5, 1, 1.25,1.5, 2] }' width="720" height="420" data-setup="{}">
|
||||
<source src="/watch/{{video.id}}" type="video/mp4">
|
||||
<track label="English" kind="subtitles" srclang="en" src="captions/vtt/sintel-en.vtt" default>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user