Tom Clarkson is a SharePoint consultant and entrepreneur based in Sydney, Australia.

Contact Details

Links



Recent Searches



Archives




Past Posts







RSS Feed

Adding Embedded Video to a SharePoint Blog

SharePoint 2007
Monday September 24 2007

 
A client recently asked me how to put video into a SharePoint blog post. Naturally it turns out to be one of those things that isn't as straightforward as it seems at first. Put the html into a post and it gets filtered out.
 
A little investigation shows that the filtering is happening in the editor - if you modify the Body column in the Posts list to be a plain text field any custom html makes it to the page without any issues. It's a solution that works as far as the reader can tell, but manually editing html tags for the entire post is hardly ideal.
 
A more usable solution is to add an additional column to the Posts list. The new column can hold any html without filtering, and you get to use the rich text editor for the rest of the post.
 
From there, you just need to get the new field to display. I'm using the CKS enhanced blog, so the way to do this will be a bit different from the out of box blog template.
 
In post.xsl and postlist.xsl add
 
<xsl:value-of select="Video" disable-output-escaping="yes"/>
 
above the body of the post. The post view includes all fields by default so that will be enough to make the unfiltered field appear when viewing a single post.
 
The list view doesn't include the new fields, so you will also need to change category.aspx and home.aspx add the attribute
 
ViewFieldsXML = "<FieldRef Name='Video' Nullable='True' /><FieldRef Name='Title' Nullable='True' />"
 
to the EBE:PostList element and your posts can include video or anything else that gets filtered out by the standard editor.
 

Comments

On 21 Nov 2007 06:39, Wayne said:
I am not sure on the location of the inserts. Is it possible to give a screen shot of both files( code snippet anyway)
Thanks
On 21 Nov 2007 06:50, Wayne said:
I am not sure on the location of the inserts. Is it possible to give a screen shot of both files( code snippet anyway)
Thanks
On 20 Dec 2007 04:05, Loic said:
Can you give us a more precise example about how to add videos in blogs?

I don't understand how you can display this video adding a column in your posts list because all the object and embed tags are filtered when you click on publish button.

Thx for help.
On 09 Feb 2008 03:02, Tom Clarkson said:
The tags only get stripped out if you use the rich text editor, which will write only the html it understands. If you set it up as plain text it will remain as you entered it.

There are some additional complications if you are using publishing pages, but that doesn't apply in this case.
On 23 Feb 2008 12:08, Marlon said:
Have you been able to get the text field to that hold object tag to show in a blog editor like Window Live Writer.  I like your suggestion but if the text field does not show in the blog editor, then users of the blog I am creating will not want to use this method.
On 23 Feb 2008 09:28, Tom Clarkson said:
I haven't tried using this with another blog editor, so I wouldn't expect it to work as is. I usually post to my blog from OneNote, but I publish as a draft then do a final edit through the web form so I can add any less standard bits through that interface. 

It would probably be possible to make a similar approach work with a blog editor though. Since the indications I've seen are that it is the editing component that strips out object tags, it would be interesting to see what an event handler on the post list sees when something is posted from the alternate editor. If the necessary data turns out to be there, you might be able to convert it to the multi-field representation, or do something similar to the [[]] formatting for links in the wiki.

On 23 Apr 2008 05:57, Angela said:
Hi Tom,

We are trying to do something similar.  Can this be done without using CKS enhanced blog?
If yes, how can we make the additional field appear on the blog post? 

Thanks.
Angela
On 24 Apr 2008 02:49, Tom Clarkson said:
Without CKS adding the video to the page would be a bit different. The exact method would depend on whether you are using code or sharepoint designer - it's all based on standard sharepoint list items, so either the dataview or custom code should work for making a custom view of the posts list that includes the video.
On 24 Apr 2008 06:57, Angela said:
Hi Tom,

Thanks for the reply.

I inserted a new column "Video" as a text field as advised. Using Designer and dataview, I can only insert this new column as a hyperlink. Our videos are streamed from another server and the url has to be "mms://filename.wmv".

Have not been able to make the video appear except as a hyperlink.

Any advice will be much appreciated.

Thanks,
Angela
On 24 Apr 2008 10:22, Tom Clarkson said:
Yes, the visual tools will only take you so far. However, if you can get it to show up as a link you can probably also edit the xsl manually and use it as part of whatever html you want to put in.
On 25 Apr 2008 10:09, Angela said:
Hi Tom,

Thanks a lot for the advice. I managed to make the video appear on the blog post.  =)

Angela
On 27 Apr 2008 03:10, affendi said:
Hi Angela, can u detail a step by step instructions how you get the video to appear on the blog post ? We just couldn't get it up ! Thanks in advance.

Affendi.
On 07 May 2008 11:39, Angela said:
Hi Affendi,

Sorry for the late reply.

Our videos are streamed from another server so not sure if your case is the same.

Here's what I did:

1) Just as Tom said in his post above, create a new column (I named it "video") using single line or multiline text but the type must be "plain text".

2) Suggest you create a new post and enter some data first. In the newly created "video" column, I have to enter something like this:
mms://servername/filename.wmv.

3) The "video" column does not appear on the blog post. Have to make it appear using Designer.

In Microsoft Designer, open the post page. The blog post is actually a list view web part. Convert this to a xslt data view.

4)  Upon conversion, the data source will be available. Drag the "video" field into the blog post where you want the video to appear.

5)If you look at the code where the new field is added, you should see something like:
<xsl:value-of select="@Video" />

6) Replace the above with:
<embed src="{@Video}" />

Save the file and the video should appear on the blog post.  

Hope it works for you.  =)

On 07 May 2008 11:39, Angela said:
Hi Affendi,

Sorry for the late reply.

Our videos are streamed from another server so not sure if your case is the same.

Here's what I did:

1) Just as Tom said in his post above, create a new column (I named it "video") using single line or multiline text but the type must be "plain text".

2) Suggest you create a new post and enter some data first. In the newly created "video" column, I have to enter something like this:
mms://servername/filename.wmv.

3) The "video" column does not appear on the blog post. Have to make it appear using Designer.

In Microsoft Designer, open the post page. The blog post is actually a list view web part. Convert this to a xslt data view.

4)  Upon conversion, the data source will be available. Drag the "video" field into the blog post where you want the video to appear.

5)If you look at the code where the new field is added, you should see something like:
<xsl:value-of select="@Video" />

6) Replace the above with:
<embed src="{@Video}" />

Save the file and the video should appear on the blog post.  

Hope it works for you.  =)

On 28 May 2008 04:01, Paul said:
Hi Angela, I was with you through steps 1,2,3 but on converting the list view web part to xslt I got an error - Failed setting processor stylesheet: 0x80004005: Expression expected: .-->=<-- @Author

I've clearly messed up somewhere ... are you able to provide further pointers?

Thanks a million
On 28 May 2008 06:32, Tim said:
Are you changing default.aspx?
On 02 Jun 2008 01:49, Tom Clarkson said:
@Paul - That sort of error isn't easily tracked down. Not all things you can do in designer get translated to xsl well, so the best option is to work from a new dataview/listview.

@Tim - With CKS:EBE you change post.xsl, postlist.xsl, home.aspx and category.aspx. With out of box sharepoint you are changing a web part which could be on any page.
On 22 Jul 2008 10:31, Boris Gomiunik said:
Neat stuff. Maybe this can also be of some assistance, I just published it in the Codeplex:

www.codeplex.com/erte

It enables you to imbed it directly in the post.
On 04 Mar 2009 05:31, Melissa said:
I use the ERTE mentioned in the comment above and it works like a charm without having the to spend hours tinkering with Sharepoint. Just install the java script and gif file in the master page folder and edit one line of code on the master default page and your good to go. Give you an embed button on the Text Rich Editor Toolbar.
On 05 Aug 2009 02:38, said:
On 05 Nov 2009 12:59, davetiye said:
güzel davetiye sözleri ve davetiye metinleri
On 05 Nov 2009 09:39, davetiye said:
güzel davetiye sozleri ve davetiye modelleri
On 06 Nov 2009 10:31, davetiye said:
güzel davetiye sözleri ve davetiye metinleri
On 20 Nov 2009 10:46, davetiyeci said:
düğün davetiyesi ve davetiye sözleri
On 28 Dec 2009 07:39, Lynne said:
I have followed all of the steps above and have the extra (video) field displayed in the section where my blog appears but it is not displaying the video. Please help as I have now been working on this for several days with no success.

Leave a comment