Commit c3102561 authored by JC Brand's avatar JC Brand

updates #1795: Only download metadata for video files

parent c6c65749
......@@ -1973,8 +1973,7 @@
let media = view.el.querySelector('.chat-msg .chat-msg__media');
expect(media.innerHTML.replace(/(\r\n|\n|\r)/gm, "")).toEqual(
'<!-- src/templates/video.html -->'+
'<video controls="" src="https://montague.lit/video.mp4" style="max-height: 50vh"></video>'+
'<a target="_blank" rel="noopener" href="https://montague.lit/video.mp4">Download video file "video.mp4"</a>');
'<video controls="" preload="metadata" src="https://montague.lit/video.mp4" style="max-height: 50vh"></video>');
// If the <url> and <body> contents is the same, don't duplicate.
stanza = u.toStanza(`
......@@ -1991,8 +1990,7 @@
media = view.el.querySelector('.chat-msg:last-child .chat-msg__media');
expect(media.innerHTML.replace(/(\r\n|\n|\r)/gm, "")).toEqual(
'<!-- src/templates/video.html -->'+
'<video controls="" src="https://montague.lit/video.mp4" style="max-height: 50vh"></video>'+
'<a target="_blank" rel="noopener" href="https://montague.lit/video.mp4">Download video file "video.mp4"</a>');
'<video controls="" preload="metadata" src="https://montague.lit/video.mp4" style="max-height: 50vh"></video>');
done();
}));
......
<video controls src="{{{o.url}}}" style="max-height: 50vh"></video>
<a target="_blank" rel="noopener" href="{{{o.url}}}">{{{o.label_download}}}</a>
<video controls preload="metadata" src="{{{o.url}}}" style="max-height: 50vh"></video>
......@@ -223,11 +223,7 @@ u.renderImageURLs = function (_converse, el) {
u.renderMovieURL = function (_converse, url) {
const uri = new URI(url);
if (u.isVideoURL(uri)) {
const { __ } = _converse;
return tpl_video({
'url': url,
'label_download': __('Download video file "%1$s"', decodeURI(uri.filename()))
})
return tpl_video({url});
}
return url;
};
......
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