add peertube tag for easy embedding of videos via download server
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Max Mehl 2022-08-08 17:05:29 +02:00
parent adcd4b1f17
commit d67f43226e
Signed by: max.mehl
GPG Key ID: 2704E4AB371E2E92
2 changed files with 82 additions and 0 deletions

81
build/xslt/peertube.xsl Normal file
View File

@ -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>

View File

@ -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" />