Commit ec92e4d7 authored by Julian Rother's avatar Julian Rother
Browse files

Added seek parameter for player pages

parent 71e0a501
......@@ -497,7 +497,7 @@ def lecture(id, course=None, courseid=None):
flash(text+'. <a target="_blank" class="reloadonclose" href="'+url_for('start_l2pauth')+'">Hier authorisieren</a>.', category='player')
else:
flash(text+'.', category='player')
return render_template('embed.html' if request.endpoint == 'embed' else 'lecture.html', course=courses[0], lecture=lecture, videos=videos, chapters=chapters)
return render_template('embed.html' if request.endpoint == 'embed' else 'lecture.html', course=courses[0], lecture=lecture, videos=videos, chapters=chapters, seek=request.args.get('t'))
@app.route('/search')
......
......@@ -11,7 +11,7 @@
{% block content %}
<div class="row">
<div class="col-xs-12" style="padding: 0px">
{{ player(lecture, videos, get_flashed_messages(category_filter=['player','message'])) }}
{{ player(lecture, videos, get_flashed_messages(category_filter=['player','message']), seek=seek) }}
</div>
</div>
......
......@@ -34,7 +34,7 @@
</div>
<div class="row">
<div class="col-xs-12" style="padding: 0px">
{{ player(lecture, videos, get_flashed_messages(category_filter=['player'])) }}
{{ player(lecture, videos, get_flashed_messages(category_filter=['player']), seek=seek) }}
</div>
<div class="col-xs-12" style="padding-top: 20px">
<p>{{ moderator_editor(['lectures',lecture.id,'comment'], lecture.comment) }}</p>
......
......@@ -48,10 +48,15 @@
{% endmacro %}
{% macro player(lecture, videos, msgs=[], autoplay=True) %}
{% macro player(lecture, videos, msgs=[], autoplay=True, seek=None) %}
{% if seek == None %}
{% set mfrag = "" %}
{% else %}
{% set mfrag = "#t="+seek %}
{% endif %}
<video id="videoplayer" style="width: 100%" class="video-js vjs-default-skin vjs-big-play-centered" width="640" height="320" controls data-wasnotplayed="1" data-setup='{ "language":"de", "plugins" : {"hotkeys": {"seekStep": 15, "enableVolumeScroll": false, "alwaysCaptureHotkeys": true}, "videoJsResolutionSwitcher": { "ui": true, "default": "720p", "dynamicLabel": false } }, "customControlsOnMobile": true, "playbackRates": [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4] }'>
{% for v in videos|sort(attribute='formats.player_prio', reverse=True) %}
<source type="{{ v.formats.mimetype }}" src="{{ config.VIDEOPREFIX }}/{{ v.path }}" data-label="{{ v.formats.description }}" data-res="{{v.formats.resolution}}" data-aspect="{{v.formats.aspect}}" data-player_prio="{{v.formats.player_prio}}"/>
<source type="{{ v.formats.mimetype }}" src="{{ config.VIDEOPREFIX }}/{{ v.path }}{{mfrag}}" data-label="{{ v.formats.description }}" data-res="{{v.formats.resolution}}" data-aspect="{{v.formats.aspect}}" data-player_prio="{{v.formats.player_prio}}"/>
{% endfor %}
<track srclang="de" kind="chapters" src="{{ url_for('chapters',lectureid=lecture.id) }}" />
</video>
......@@ -60,7 +65,6 @@ $(function() {
$('#videoplayer').addClass("vjs-fluid");
$('#videoplayer').css("width");
videojs("videoplayer").ready(function() {
//resume
var progress_key = "progress_{{ lecture.id }}";
var seconds_played;
......@@ -69,7 +73,9 @@ $(function() {
if (!seconds_played) {
seconds_played = 0;
} else {
{% if seek == None %}
videojs('videoplayer').currentTime(seconds_played);
{% endif %}
}
}
videojs("videoplayer").on("timeupdate", function() {
......
Markdown is supported
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