FAQ: Add YouTube video embedding support for InstantForum.NET
This article shows users of InstantForum.NET 4.1.4 or earlier how to allow community members to easily embed YouTube videos within forum posts.
With the built-in support for YouTube videos in the forthcoming InstantForum.NET 4.2 update we wanted to share some code we created with existing 4.1.4 users.
Lets say you wanted to share one of our videos within a post...
http://www.youtube.com/watch?v=MS8hPKeRY4Y
If your using InstantForum.NET 4.1.4 or earlier uou can add an IFCode tag to embed this video directly within posts.
For example a nice way to embed this would be...
[YouTube]http://www.youtube.com/watch?v=MS8hPKeRY4Y[/YouTube]
When posted this would be translated via our IFCode feature and would display within posts as shown below...

For further information on how to use IFCode please see...
http://docs.instantasp.co.uk/InstantForum/managingifcode.html
To provide support for this you will need to add a new IFCode for 4.1.4. You should login as an administrator for your forum and navigate to the Admin CP. Within the navigation on the left locate the Add IFCode option. When adding a new IFCode use the following information...
Friendly Name
YouTube
Tag Example
[YouTube][/YouTube]
Actual code to insert
[YouTube][/YouTube]
Search Pattern
\[YouTube\](.*?)youtube.com/watch\?v=(.*?)\[\/YouTube\]
Replace Pattern
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/$2&hl=en&fs=1&">
</param><param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/$2&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed>
</object>
That's It!
Save our new IFCode and this will be accessible when adding new posts within InstantForum.NET 4.1.4. As indicated above this has been greatly improved with the forthcoming 4.2 update and we now have a dialog which allows you to add YouTube URLs directly from within the editor.
As always if you have any questions please don't hesitate to leave a comment below or contact us.
We would welcome suggestions for other video services you would like to see supported. For exmaple Ustream etc.