What is that ?
Based on this excellent tutorial from kirk Evans : http://blog.evepoints.com/2010/11/add-video-sharepoint-2010-blog.html
This will allow you to add youtube video in a blog content.
Basic sharepoint feature permit you to add the video by modifying the HTML code, from the Insert HTML button of sharepoint, but that is not really user friendly.
Preview, on a blog post :
Â
New youtube embedded format ?
I modified one of the method of Kirk Evans in order to accept the new youtube embedded video format. The new embedded video format looks like this :
New youtube embedded code for video (<iframe) :
Old youtube embedded code for video (object) :
So to update Kirk Evans code, replace the last method by :
1: private string ReplaceEmbedsWithTokens(string body)
2: {
3: //VARS
4: string returnString = null;
5: //Old version of youtube embedded
6: Regex rx = new Regex("(<object).*?(<embed src=")(?<src>.*?)(")(.*?)(</object>)");
7:
8: //CLEANING from a text editor
9: body = body.Replace("nr", " ");
10: body = body.Replace("rn", " ");
11:
12: if (rx.IsMatch(body) == false)
13: {
14: //New version of youtube embedded
15: rx = new Regex("(<iframe).*?(src=")(?<src>.*?)(")(.*?)(</iframe>)");
16: returnString = rx.Replace(body, "[[BLOGVIDEO: ${src}]]");
17: returnString = returnString.Replace("embed", "v");
18: }
19: else
20: {
21: //Old version of youtube embedded
22: returnString = rx.Replace(body, "[[BLOGVIDEO: ${src}]]");
23: }
24:
25:
26: return returnString;
27: }
It also fix a bug : when you paste the embedded code in a word document in order to save it, and then you paste it in a blog, it won’t work properly.
Enjoy, and thanks again Kirk Evans
After study a number of of the blog posts on your website now, and I actually like your means of blogging. I bookmarked it to my bookmark web site checklist and can be checking again soon. Pls take a look at my website as nicely and let me know what you think.