Here's how to create a BB Code to embed Twitch videos.
Go to AdminCP > Custom BB Codes > Add New BB Code and enter the following information:
Title: Twitch
BB Code Tag Name: twitch
Replacement: (Replace www.yourdomain.com with your actual forum domain name. Include or exclude www depending on how the Base URL is configured in AdminCP. Twitch requires you to pass the domain of the parent page the Twitch video is embedded on)
Example: [twitch]TwitchVideoIDHere[/twitch]
Use {option}: No
Button Image (Optional): (specify image path if you want a new button for this BBCode to appear in the editor)
Rest of Options: Yes
Note: Ignore the malformed HTML warning when saving. I think this is a vB bug.
Example:
[twitch]1433394436[/twitch]
Output:
You can also use Video ID, Channel/Username, or Clip ID inside the Twitch BBCode tag.
To add clips, you need to add all characters after "/clip/" in the Clip URL and before "?" if it exists. For example, if the Twitch Clip URL is https://www.twitch.tv/myusername/clip/MyClip-UlQu2NyjJ1pbfKGa, the BBCode tag would look like this:
Go to AdminCP > Custom BB Codes > Add New BB Code and enter the following information:
Title: Twitch
BB Code Tag Name: twitch
Replacement: (Replace www.yourdomain.com with your actual forum domain name. Include or exclude www depending on how the Base URL is configured in AdminCP. Twitch requires you to pass the domain of the parent page the Twitch video is embedded on)
HTML Code:
<iframe onload="var domain='www.yourdomain.com';this.src='{param}'.includes('-')?`https://clips.twitch.tv/embed?clip={param}&parent=${domain}`:`https://player.twitch.tv/?${Number('{param}')>0?'video':'channel'}={param}&parent=${domain}`; this.onload=null;" src="" frameborder="0" allowfullscreen="true" scrolling="no" height="378" width="620" style="max-width:100%;"></iframe>
Use {option}: No
Button Image (Optional): (specify image path if you want a new button for this BBCode to appear in the editor)
Rest of Options: Yes
Note: Ignore the malformed HTML warning when saving. I think this is a vB bug.
Example:
[twitch]1433394436[/twitch]
Output:
You can also use Video ID, Channel/Username, or Clip ID inside the Twitch BBCode tag.
To add clips, you need to add all characters after "/clip/" in the Clip URL and before "?" if it exists. For example, if the Twitch Clip URL is https://www.twitch.tv/myusername/clip/MyClip-UlQu2NyjJ1pbfKGa, the BBCode tag would look like this:
Code:
[twitch]MyClip-UlQu2NyjJ1pbfKGa[/twitch]
Comment