Merge pull request 'Add peertube tag for easy embedding of videos via download server' (#2741) from peertube-snippet into master
continuous-integration/drone/push Build is passing Details

Reviewed-on: #2741
pull/2743/head
Max Mehl 6 months ago
commit 28c8804029

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- XSLT for embedding peertube videos nicely -->
<!-- ====================================================================== -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="peertube" match="peertube">
<xsl:param name="url" select="@url" />
<xsl:variable name="uuid_url">
<xsl:text>https://download.fsfe.org/videos/peertube/</xsl:text>
<xsl:value-of select="substring-after($url,'https://media.fsfe.org/w/')" />
</xsl:variable>
<xsl:element name="video">
<xsl:attribute name="crossorigin">crossorigin</xsl:attribute>
<xsl:attribute name="poster">
<xsl:value-of select="$uuid_url" />
<xsl:text>.jpg</xsl:text>
</xsl:attribute>
<xsl:attribute name="controls">controls</xsl:attribute>
<!-- MP4 1080p -->
<xsl:element name="source">
<xsl:attribute name="type">video/mp4; codecs="avc1.42E01E, mp4a.40.2"</xsl:attribute>
<xsl:attribute name="media">screen and (min-width:1200px)</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$uuid_url" />
<xsl:text>_1080p.mp4</xsl:text>
</xsl:attribute>
</xsl:element>
<!-- MP4 720p -->
<xsl:element name="source">
<xsl:attribute name="type">video/mp4; codecs="avc1.42E01E, mp4a.40.2"</xsl:attribute>
<xsl:attribute name="media">screen and (max-width:1199px)</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$uuid_url" />
<xsl:text>_720p.mp4</xsl:text>
</xsl:attribute>
</xsl:element>
<!-- MP4 360p -->
<xsl:element name="source">
<xsl:attribute name="type">video/mp4; codecs="avc1.42E01E, mp4a.40.2"</xsl:attribute>
<xsl:attribute name="media">screen and (max-width:420px)</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$uuid_url" />
<xsl:text>_360p.mp4</xsl:text>
</xsl:attribute>
</xsl:element>
<!-- WEBM 1080p -->
<xsl:element name="source">
<xsl:attribute name="type">video/webm; codecs="vp9, opus"</xsl:attribute>
<xsl:attribute name="media">screen and (min-width:1200px)</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$uuid_url" />
<xsl:text>_1080p.webm</xsl:text>
</xsl:attribute>
</xsl:element>
<!-- WEBM 720p -->
<xsl:element name="source">
<xsl:attribute name="type">video/webm; codecs="vp9, opus"</xsl:attribute>
<xsl:attribute name="media">screen and (max-width:1199px)</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$uuid_url" />
<xsl:text>_720p.webm</xsl:text>
</xsl:attribute>
</xsl:element>
<!-- WEBM 360p -->
<xsl:element name="source">
<xsl:attribute name="type">video/webm; codecs="vp9, opus"</xsl:attribute>
<xsl:attribute name="media">screen and (max-width:420px)</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$uuid_url" />
<xsl:text>_360p.webm</xsl:text>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

@ -19,6 +19,7 @@
<xsl:include href="build/xslt/module.xsl" />
<xsl:include href="build/xslt/related.xsl" />
<xsl:include href="build/xslt/email-obfuscate.xsl" />
<xsl:include href="build/xslt/peertube.xsl" />
<!-- HTML 5 compatibility doctype, since our XSLT parser doesn't support disabling output escaping -->
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />

Loading…
Cancel
Save