Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
ec92e4d7
Commit
ec92e4d7
authored
Aug 31, 2017
by
Julian Rother
Browse files
Added seek parameter for player pages
parent
71e0a501
Changes
4
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
ec92e4d7
...
...
@@ -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'
)
...
...
templates/embed.html
View file @
ec92e4d7
...
...
@@ -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>
...
...
templates/lecture.html
View file @
ec92e4d7
...
...
@@ -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>
...
...
templates/macros.html
View file @
ec92e4d7
...
...
@@ -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
()
{
...
...
Julian Rother
@julianr
mentioned in issue
#334 (closed)
·
Sep 22, 2017
mentioned in issue
#334 (closed)
mentioned in issue #334
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment