Hard Light Productions Forums

Site Management => Site Support / Feedback => Topic started by: ksotar on November 18, 2017, 06:20:19 pm

Title: Embedded youtube video doesn't work
Post by: ksotar on November 18, 2017, 06:20:19 pm
Here it is: http://www.hard-light.net/forums/index.php?topic=94136.msg1858243#msg1858243

It shows player window, but if I press "Play" there is an error.
Title: Re: Embedded youtube video doesn't work
Post by: niffiwan on November 18, 2017, 06:52:40 pm
You only need the youtube ID in the [ yt ] tags. You've added the full URL. Do it like this:

Title: Re: Embedded youtube video doesn't work
Post by: BlueFlames on November 18, 2017, 06:53:39 pm
In fairness, that mistake is made often enough that it seems like using the full URL should be supported by the [ yt ] tag.
Title: Re: Embedded youtube video doesn't work
Post by: AdmiralRalwood on November 18, 2017, 07:12:40 pm
In fairness, that mistake is made often enough that it seems like using the full URL should be supported by the [ yt ] tag.
It's been requested before and denied.
Title: Re: Embedded youtube video doesn't work
Post by: Goober5000 on November 19, 2017, 01:49:30 am
It's been requested before and denied.

The problem is the need to extract the video ID from the URL.  I don't think anyone has specifically ruled it out (correct me if I'm wrong), just expressed doubt on the proper way to code it.

Here is the current code for the yt BBCode tag.  If someone can enhance it, I'll be happy to merge the changes:
Code: [Select]
array(
'tag' => 'yt',
'type' => 'unparsed_content',
'parameters' => array(
'time' => array('optional' => true, 'value' => '?start=$1', 'match' => '(\d+)'),
'size' => array('optional' => true, 'value' => ' media-$1', 'match' => '(small|medium|large|max)')
),
'content' => '
<div class="mediaWidthLimit{size}">
<div class="mediaWrapper">
<iframe id="$1" width="560" height="315" src="//www.youtube-nocookie.com/embed/$1{time}" frameborder="0" allowfullscreen></iframe>
</div>
</div>',
'block_level' => true,
),
array(
'tag' => 'yt',
'type' => 'unparsed_content',
'content' => '
<div class="mediaWidthLimit">
<div class="mediaWrapper">
<iframe id="$1" width="560" height="315" src="//www.youtube-nocookie.com/embed/$1" frameborder="0" allowfullscreen></iframe>
</div>
</div>',
'block_level' => true,
),

Title: Re: Embedded youtube video doesn't work
Post by: ksotar on November 19, 2017, 06:46:57 am
You only need the youtube ID in the [ yt ] tags. You've added the full URL. Do it like this:


Thank you, I fixed it.

But yes, to be fair - I've never encountered such a way to embed video on any forums.