XF 2.3 How do I use iframe to display embedded links from my video streaming site?

zoldos

Well-known member
Licensed customer
I have a small Youtube "clone" streaming site. It can produce embed links for videos such as below:
Code:
<iframe src="https://xxxx.com/embed/RvtVstTMzeoCsga?color=04abf2" frameborder="0" width="700" height="400" allowfullscreen></iframe>
However, this doesn't work on my forum. It just shows the link. I've enabled "Convert Markdown-style content to BB code" and I added "iframe" to "Allowed code BB code block languages". But honestly, I have no idea what I'm doing.

Can anyone assist? Thanks!

@JoshyPHP
 
You can't just paste raw iframe HTML into posts — XenForo strips it for security. What you need is a BB Code Media Site definition, which is the proper way to handle video embeds.
Go to ACP > Content > BB code media sites > Add BB code media site:
  • Media site ID: myvideosite (or whatever you want)
  • Site title: Your site name
  • Match URLs — add patterns that match your embed URLs, using {$id} to capture the video ID:
Code:
https://yoursite.com/embed/{$id}
https://yoursite.com/watch/{$id}
Embed HTML:
Code:
<div class="bbMediaWrapper">
    <div class="bbMediaWrapper-inner">
        <iframe src="https://yoursite.com/embed/{$id}"
                frameborder="0" width="700" height="400"
                allowfullscreen style="max-width: 100%"></iframe>
    </div>
</div>
After saving, users just paste the video URL in a post and XenForo auto-embeds it (as long as "Auto-embed media links" is enabled in ACP > Options > Messages). No special BB code tags needed — it works just like YouTube links.
The "Allowed code BB code block languages" setting you tried is for syntax highlighting in [CODE] blocks, not for embedding HTML — that's why it didn't help.
 
You can't just paste raw iframe HTML into posts — XenForo strips it for security. What you need is a BB Code Media Site definition, which is the proper way to handle video embeds.
Go to ACP > Content > BB code media sites > Add BB code media site:
  • Media site ID: myvideosite (or whatever you want)
  • Site title: Your site name
  • Match URLs — add patterns that match your embed URLs, using {$id} to capture the video ID:
Code:
https://yoursite.com/embed/{$id}
https://yoursite.com/watch/{$id}
Embed HTML:
Code:
<div class="bbMediaWrapper">
    <div class="bbMediaWrapper-inner">
        <iframe src="https://yoursite.com/embed/{$id}"
                frameborder="0" width="700" height="400"
                allowfullscreen style="max-width: 100%"></iframe>
    </div>
</div>
After saving, users just paste the video URL in a post and XenForo auto-embeds it (as long as "Auto-embed media links" is enabled in ACP > Options > Messages). No special BB code tags needed — it works just like YouTube links.
The "Allowed code BB code block languages" setting you tried is for syntax highlighting in [CODE] blocks, not for embedding HTML — that's why it didn't help.
Cool, thanks!!
 
Back
Top Bottom