SharePoint 2010: Insert a video in Blog
I have come up with requirement of embedding the Youtube video in SharePoint blog. First i thought it would be very easy with the adding with Media Player webpart of SharePoint 2010 or using HTML content. But when i have started on that then ,I have gone through following links. First one is some what difficult,
- http://blogs.msdn.com/b/kaevans/archive/2010/06/15/embedding-flash-video-in-sharepoint-blogs.aspx
- http://blogs.msdn.com/b/sharepointdesigner/archive/2009/12/11/video-blogging-with-javascript-and-the-media-web-part.aspx
then i feel even both of the Solution doesn't meet my requirement as i would like to add the Youtube link into SharePoint and Normal User don't have to any kind formating he just have to go Youtube and he will click on Share and will take the link and put on the SharePoint blog.
I always try to find simple solution to complex problem. I dont want to write the Event Handlers, many customization.
Perform following steps
- I started to to write Small Jquery script which you have to add in the end of the MasterPage or put at the end of <body> tag.
<script type="text/javascript">
$(document).ready(function()
{
allEntries = $('.ms-PostBody');
for (var i=0; i<allEntries.length;i++)
{
entryContent=allEntries[i].firstChild.innerHTML;
var NewHtml= entryContent.replace("<", "<" ).replace(">",">");
allEntries[i].innerHTML=NewHtml;
}
});
</script>
- Open Youtube
Click on Share and take the IFrame part of that Video
Now click on new Post in Blog Site add the Content with Iframe text.
Remove the link which is creating when you paste on this Url. Click on that url and click on the Format tab and Click on Remove Link.
5.Click on Publish.
And you can see your Video in SharePoint blog. So easy. Enjoy!