and get my head around XSL in the process. Here's what I have so far.
BBCode usage,
Code: Select all
[YouTubeSE end={NUMBER2?}]https://www.youtube.com/watch?v={SIMPLETEXT} {NUMBER1}[/YouTubeSE]
HTML replacement
Code: Select all
<xsl:choose>
<xsl:when test="@end">
<center><div class="container">
<iframe class="responsive-iframe" src="https://www.youtube.com/embed/{SIMPLETEXT}?start={NUMBER1}&end={NUMBER2}">
</iframe>
</div></center>
</xsl:when>
<xsl:otherwise>
<center><div class="container">
<iframe class="responsive-iframe" src="https://www.youtube.com/embed/{SIMPLETEXT}?start={NUMBER1}">
</iframe>
</div></center>
</xsl:otherwise>
</xsl:choose>
Works absolutely fine if I only enter the start time. If I don't bother with the XSL stuff and make the start time and end time compulsory, it works fine then too, as long as the BBCode usage box says,
Code: Select all
[YouTubeSE}]https://www.youtube.com/watch?v={SIMPLETEXT} {NUMBER1} {NUMBER2}[/YouTubeSE]
and the HTML replacement box says,
Code: Select all
<center><div class="container">
<iframe class="responsive-iframe" src="https://www.youtube.com/embed/{SIMPLETEXT}?start={NUMBER1}&end={NUMBER2}">
</iframe>
</div></center>
But I can't figure out how to get it to work the way I want. If someone enters 10 and 20, say, the video starts playing at 0:10 and stops at 0:20, but if someone doesn't bother to enter an end time, the video starts at 0:10 and just goes on until the end. With all the XSL code above in place and the BBVode usage box reading as it does at the top of the post, like I said, if I enter a start time, it plays from there fine and goes on until the end, but if I enter an end time too, the video appears blank, just black. And if I hit the play button, I get a grey YouTube error message.