Updated video templates
authorThierry Florac <thierry.florac@onf.fr>
Mon, 27 Aug 2018 11:02:44 +0200
changeset 100 7ac21495e0b1
parent 99 9c39875de0af
child 101 0cb6cb0ac01c
Updated video templates
src/pyams_media/zmi/templates/video-preview.pt
src/pyams_media/zmi/templates/video-thumbnail.pt
--- a/src/pyams_media/zmi/templates/video-preview.pt	Fri Jul 20 12:46:57 2018 +0200
+++ b/src/pyams_media/zmi/templates/video-preview.pt	Mon Aug 27 11:02:44 2018 +0200
@@ -7,17 +7,20 @@
 					 data-ams-callback-source tales:resource_path('pyams_media.skin:pyams_media');">
 	<video
 		tal:define="href tales:absolute_url(context);
+					conversions tales:conversions(context);
 					thumbnails tales:thumbnails(context);
-					conversions tales:conversions(context);
-					size thumbnails.get_image_size();"
-		tal:attributes="poster string:${href}/++thumb++${size[0]}x${size[1]}.png?_=${view.timestamp}">
+					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 tales:absolute_url(conversion);
+									src media_src.replace('+', '%2b');
 									media 'all and (max-width: {0}px)'.format(media_width) if media_width else None;" />
 		</tal:loop>
 	</video>
--- a/src/pyams_media/zmi/templates/video-thumbnail.pt	Fri Jul 20 12:46:57 2018 +0200
+++ b/src/pyams_media/zmi/templates/video-thumbnail.pt	Mon Aug 27 11:02:44 2018 +0200
@@ -8,16 +8,20 @@
 	 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);
-					conversions tales:conversions(context);
-					size thumbnails.get_image_size();"
-		tal:attributes="poster string:${href}/++thumb++${size[0]}x${size[1]}.png?_=${view.timestamp}">
+					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)"
+									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;" />