Commit 55be3fb9 authored by Julian Rother's avatar Julian Rother
Browse files

Added timeline chapters markers

parent f480b090
import json
from server import *
@app.route('/internal/newchapter/<int:lectureid>', methods=['POST', 'GET'])
......@@ -31,4 +32,6 @@ def chapters(lectureid):
c['start'] = c['time']
c['end'] = last['start'] if last else 9999
last = c
if 'json' in request.values:
return Response(json.dumps([{'time': c['time'], 'text': c['text']} for c in chapters]), mimetype='application/json')
return Response(render_template('chapters.srt',chapters=chapters), 200, {'Content-Type':'text/vtt'})
......@@ -18,6 +18,7 @@
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='style.css')}}">
<link rel="stylesheet" href="{{url_for('static', filename='font-awesome/css/font-awesome.css')}}">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='videojs/video-js.css')}}">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='videojs/videojs.markers.css')}}">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='videojs/videojs-resolution-switcher.css')}}">
<script src="{{url_for('static', filename='jquery.js')}}"></script>
......@@ -33,6 +34,7 @@
<script src="{{url_for('static', filename='videojs/videojs-resolution-switcher.js')}}"></script>
<script src="{{url_for('static', filename='videojs/videojs-contrib-hls.js')}}"></script>
<script src="{{url_for('static', filename='videojs/videojs.hotkeys.js')}}"></script>
<script src="{{url_for('static', filename='videojs/videojs-markers.js')}}"></script>
{% endblock %}
</head>
<body>
......
......@@ -97,6 +97,25 @@ $(function() {
videojs("videoplayer").createModal('',{"uncloseable": true }).contentEl().innerHTML='<div class="hidden-print alert alert-danger" role="alert">{{ msg|safe }}</div>';
{% endfor %}
//markers
$.ajax({method: "GET", url: "{{url_for('chapters',lectureid=lecture.id, json=1)}}", dataType: "json",
success: function (data) {
videojs("videoplayer").markers({
markerStyle: {
'width':'5px',
'border-radius': '40%',
'background-color': 'black'
},
markerTip:{
display: true,
text: function(marker) {
return marker.text;
}
},
markers: data});
}});
});
</script>
{% endmacro %}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment