--- a/src/pyams_media/skin/templates/video.pt Thu Dec 20 08:42:49 2018 +0100
+++ b/src/pyams_media/skin/templates/video.pt Thu Dec 20 09:57:21 2018 +0100
@@ -4,7 +4,7 @@
size thumbnails.get_image_size();
thumbnail thumbnails.get_thumbnail('{0}x{1}'.format(size[0], size[1]), 'png');
timestamp tales:timestamp(thumbnail);"
- controls
+ controls="${'controls' if controls else None}"
poster="${href}/++thumb++${size[0]}x${size[1]}.png?_=${timestamp}">
<tal:loop repeat="conversion conversions.get_conversions(order=('video/webm','video/mp4','video/x-flv'))">
<source tal:define="media_width conversions.get_conversion_width(conversion.__name__);
--- a/src/pyams_media/skin/video.py Thu Dec 20 08:42:49 2018 +0100
+++ b/src/pyams_media/skin/video.py Thu Dec 20 09:57:21 2018 +0100
@@ -33,7 +33,7 @@
_render = get_view_template()
- def render(self, context=None, *args, **kwargs):
+ def render(self, context=None, controls=True, *args, **kwargs):
"""Video renderer
Method signature accepts unused *args and **kwargs to match 'picture' TALES extension.
@@ -41,7 +41,8 @@
if context is None:
context = self.context
return render('templates/video.pt', {
- 'video': context
+ 'video': context,
+ 'controls': controls
}, request=self.request)
--- a/src/pyams_media/zmi/templates/video-preview.pt Thu Dec 20 08:42:49 2018 +0100
+++ b/src/pyams_media/zmi/templates/video-preview.pt Thu Dec 20 09:57:21 2018 +0100
@@ -3,23 +3,5 @@
data-ams-plugin-pyams_media-callback="PyAMS_media.initPlayer"
tal:attributes="data-ams-plugin-pyams_media-src tales:resource_path('pyams_media.skin:pyams_media');
data-ams-plugin-pyams_media-css tales:resource_path('pyams_media.skin:functional_css');">
- <video
- tal:define="href tales:absolute_url(context);
- conversions tales:conversions(context);
- thumbnails tales:thumbnails(context);
- size thumbnails.get_image_size();
- thumbnail thumbnails.get_thumbnail('{0}x{1}'.format(size[0], size[1]), 'png');
- timestamp tales:timestamp(thumbnail);"
- poster="${href}/++thumb++${size[0]}x${size[1]}.png?_=${timestamp}">
- <tal:loop repeat="conversion conversions.get_conversions(order=('video/webm','video/mp4','video/x-flv'))">
- <source type="video/mp4"
- tal:define="media_width conversions.get_conversion_width(conversion.__name__);
- media_src tales:absolute_url(conversion);
- video_type tales:video_type(conversion);"
- tal:condition="video_type"
- tal:attributes="type video_type;
- src media_src.replace('+', '%2b');
- media 'all and (max-width: {0}px)'.format(media_width) if media_width else None;" />
- </tal:loop>
- </video>
+ ${structure:tales:video(context, controls=False)}
</div>
--- a/src/pyams_media/zmi/templates/video-thumbnail.pt Thu Dec 20 08:42:49 2018 +0100
+++ b/src/pyams_media/zmi/templates/video-thumbnail.pt Thu Dec 20 09:57:21 2018 +0100
@@ -4,26 +4,5 @@
tal:attributes="data-ams-plugin-pyams_media-src tales:resource_path('pyams_media.skin:pyams_media');
data-ams-plugin-pyams_media-css tales:resource_path('pyams_media.skin:functional_css');"
data-ams-flowplayer-events='{"pause": "PyAMS_media.getPlayerTime", "seek": "PyAMS_media.getPlayerTime"}'>
- <video
- tal:define="href tales:absolute_url(context);
- conversions tales:conversions(context);
- thumbnails tales:thumbnails(context);
- size thumbnails.get_image_size();
- thumbnail thumbnails.get_thumbnail('{0}x{1}'.format(size[0], size[1]), 'png');
- timestamp tales:timestamp(thumbnail);"
- poster="${href}/++thumb++${size[0]}x${size[1]}.png?_=${timestamp}">
- <tal:loop repeat="conversion conversions.get_conversions(order=('video/webm','video/mp4','video/x-flv'))">
- <tal:if define="video_type tales:video_type(conversion);"
- condition="video_type">
- <source type="video/mp4"
- tal:define="media_width conversions.get_conversion_width(conversion.__name__);
- media_src tales:absolute_url(conversion);
- video_type tales:video_type(conversion);"
- tal:condition="video_type"
- tal:attributes="type video_type;
- src media_src.replace('+', '%2b');
- media 'all and (max-width: {0}px)'.format(media_width) if media_width else None;" />
- </tal:if>
- </tal:loop>
- </video>
+ ${structure:tales:video(context, controls=False)}
</div>