diff --git a/assets/css/components/posts/ui.css b/assets/css/components/posts/ui.css index a6694613..26a86963 100644 --- a/assets/css/components/posts/ui.css +++ b/assets/css/components/posts/ui.css @@ -23,4 +23,9 @@ .post .post-pdf { text-align: center; +} + +.post .post-youtube { + width: 100%; + height: 300px; } \ No newline at end of file diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index 56e90ac3..82282586 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -124,6 +124,23 @@ ComunicWeb.components.posts.ui = { } + //In case of YouTube video + else if(infos.kind == "youtube"){ + + //Create iframe + var youtube_iframe = createElem2({ + appendTo: postRoot, + type: "iframe", + class: "post-youtube", + src: "https://www.youtube-nocookie.com/embed/"+infos.file_path+"?rel=0" + }); + youtube_iframe.setAttribute("frameborder", 0); + youtube_iframe.setAttribute("gesture", "media"); + youtube_iframe.setAttribute("allow", "encrypted-media"); + youtube_iframe.setAttribute("allowfullscreen", ""); + + } + //In case of PDF else if(infos.kind == "pdf"){