XF 2.2 Embeding YouTube videos without an extra addon

kelle67

Well-known member
Unfortunately, @Lukas W. is also stopping now. That's why we want to get away from extra addons. Of course, this is not possible for everything.
How can I display YouTube videos in the forum? For many years we have been using the addon from JoshyPHP
That actually works well. But why not just use board tools.

Is there a manual for it. Or can someone explain to me how I can do that?
 
Solution
This is my Youtube in BBcode media sites

Media siteID :youtube

Site Title Youtube

Site URL https://www.youtube.com

Match urls



Code:
youtube.com/watch?v={$id}
youtube.com/watch?*&v={$id}
youtube.com/v/{$id}
youtu.be/{$id}
youtube.com/*/u/*/{$id}
youtube.com/embed/{$id}
youtube.com/shorts/{$id}
youtube-nocookie.com/embed/{$id}

Embed template:

Code:
<div class="bbMediaWrapper" data-media-site-id="{$siteId}" data-media-key="{$id}">
    <div class="bbMediaWrapper-inner">
        <iframe src="https://www.youtube.com/embed/{$id}?wmode=opaque{{ $start ? '&start=' . $start : '' }}{{ $list ? '&list=' . $list : '' }}"
                width="560" height="315"
                frameborder="0" allowfullscreen="true"></iframe>
    </div>...
Code:
https://youtu.be/8Ooob3yG6zA

Copy the link from youtube and paste it in the editor:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

That's it.
 
So I have now deactivated the addon that we have been using for this.
Unfortunately, that's all I get:


1694859379241.webp
I honestly don't know what we changed or deactivated years ago.
For the link from you, the BB code for embedding videos is not generated but only that for a URL.

Code:
[URL unfurl="true"]https://youtu.be/8Ooob3yG6zA[/URL]

If I activate the addon, it works.
Code:
[MEDIA=youtube]8Ooob3yG6zA[/MEDIA]
 
Under BBcode media sites this must be switched on
Screenshot 2023-09-16 at 12.01.27.png

text editor must have BBcode [ ] toggled off.

The just paste the Youtube URL (not the embed code).

Code:
[URL unfurl="true"]https://youtu.be/8Ooob3yG6zA[/URL][.code]
[/QUOTE]


[QUOTE="kelle67, post: 1646570, member: 117445"]
For the link from you, the BB code for embedding videos is not generated but only that for a URL.
[/QUOTE]

Looks like you are pasting as link.Just paste the video URL direct into the text field for the post (with BBcode toggled off)
 
Last edited:
Okay, now we're getting closer.
Under BBcode media sites this must be switched on
It is switched on. But he addon has replaced the code there. And if I deactivate the addon, Xenforo knows what class it is.

1694866685083.webp

Or is it enough to remove the html code there and check the "Use oEmbed" box?

1694866878212.webp
 
This is my Youtube in BBcode media sites

Media siteID :youtube

Site Title Youtube

Site URL https://www.youtube.com

Match urls



Code:
youtube.com/watch?v={$id}
youtube.com/watch?*&v={$id}
youtube.com/v/{$id}
youtu.be/{$id}
youtube.com/*/u/*/{$id}
youtube.com/embed/{$id}
youtube.com/shorts/{$id}
youtube-nocookie.com/embed/{$id}

Embed template:

Code:
<div class="bbMediaWrapper" data-media-site-id="{$siteId}" data-media-key="{$id}">
    <div class="bbMediaWrapper-inner">
        <iframe src="https://www.youtube.com/embed/{$id}?wmode=opaque{{ $start ? '&start=' . $start : '' }}{{ $list ? '&list=' . $list : '' }}"
                width="560" height="315"
                frameborder="0" allowfullscreen="true"></iframe>
    </div>
</div>

Use oEmbed = off

Advanced options

URL Match: XF\BbCode\Helper\YouTube :: matchCallback


Embed HTML callback XF\BbCode\Helper\YouTube :: htmlCallback
 
Last edited:
Solution
Back
Top Bottom