1 <video tal:define="href tales:absolute_url(video); |
1 <video tal:define="href tales:absolute_url(video); |
2 conversions tales:conversions(video); |
2 conversions tales:conversions(video); |
3 thumbnails tales:thumbnails(video); |
3 thumbnails tales:thumbnails(video); |
4 size thumbnails.get_image_size(); |
4 size thumbnails.get_image_size(); |
5 thumbnail thumbnails.get_thumbnail('{0}x{1}'.format(size[0], size[1]), 'png'); |
5 thumbnail thumbnails.get_thumbnail('{0}x{1}'.format(size[0], size[1]), 'png'); |
6 timestamp tales:timestamp(thumbnail);" |
6 global media_width 0; |
|
7 global min_width 0; |
|
8 global previous_type None;" |
7 controls="${'controls' if controls else None}" |
9 controls="${'controls' if controls else None}" |
8 poster="${href}/++thumb++${size[0]}x${size[1]}.png?_=${timestamp}"> |
10 poster="${href}/++thumb++${size[0]}x${size[1]}.png?_=${tales:timestamp(thumbnail)}"> |
9 <tal:loop repeat="conversion conversions.get_conversions(order=('video/webm','video/mp4','video/x-flv'))"> |
11 <tal:loop repeat="conversion conversions.get_conversions(order=('video/mp4','video/webm','video/ogg','video/x-flv'))"> |
10 <source tal:define="media_width conversions.get_conversion_width(conversion.__name__); |
12 <tal:var define="video_type tales:video_type(conversion); |
11 media_src tales:absolute_url(conversion); |
13 min_width ((media_width or 0) + 1) if (video_type == previous_type) else 0; |
12 video_type tales:video_type(conversion);" |
14 global media_width conversions.get_conversion_width(conversion.__name__); |
13 tal:condition="video_type" |
15 media_src tales:absolute_url(conversion); |
14 type="${video_type}" |
16 media_url media_src.replace('+', '%2b');"> |
15 src="${media_src.replace('+', '%2b')}" |
17 <source tal:condition="video_type" |
16 media="${'all and (max-width: {0}px)'.format(media_width) if media_width else None}" /> |
18 type="${video_type}" |
|
19 src="${media_url}?_=${tales:timestamp(conversion)}" |
|
20 media="${'screen only{}{}'.format( |
|
21 ' and (min-width: {}px)'.format(min_width) if min_width else '', |
|
22 ' and (max-width: {}px)'.format(media_width) if media_width else '')}" /> |
|
23 <tal:var define="global previous_type video_type;" /> |
|
24 </tal:var> |
17 </tal:loop> |
25 </tal:loop> |
18 </video> |
26 </video> |