Alexander's Blog

Sharing knowledge with the global IT community since November 1, 2004

How to Add Videos to MOSS 2007 Web Part Pages

/
/
ad-mania

I have been meaning to figure out how to play WMV and other file formats directly in a SharePoint 2007 Web pages. My students and colleagues have been waiting for me to figure this out because everyone seems to be interested in playing videos in a SharePoint Web site. My business clients who deal with a lot of videos and have now migrated to a SharePoint environment have a business need to embed videos on their pages.

You can embed videos in SharePoint in various ways. For example, you can embed YouTube videos or embed videos in other formats, such as WMV, AVI, or MPEG.

Playing YouTube Videos in SharePoint

Adding YouTube videos to a SharePoint page is easy. Just follow these steps.

1. Go to YouTube and select the video you want.

2. Simply click on the embed box just below the URL box in the top right hand corner of the page and copy the embedded code.

3. Paste the code into the HTML code (Source Editor) of the Content Editor Web Part.

4. Your video will play in the Content Editor Web Part page.

Playing WMV Videos in SharePoint

Playing WMV files in SharePoint is a bit more involved. Microsoft doesn’t offer any solution out of the box and I was looking for a free solution that doesn’t involve third-party products or purchasing Web parts. I tried several solutions that are out there, none of them really worked properly or were just too cumbersome to implement. I finally found a MediaPlayerWebPart written by Steve Sofian. I found the reference to the Web part on Alex Pearce’s blog. This Web part worked like a charm. Here are all the details on how you can install and use this Web part to play WMV, AVI or MPEG videos on a SharePoint page.

The following instructions apply to Windows Server 2008 and Microsoft Office SharePoint Server (MOSS) 2007 and assume that you are logged in with administrative rights to the MOSS 2007 and Windows Server 2008.

NOTE: If you are an end user or a Site Owner then you may need to ask your IT department for help. Once they have installed the MediaPlayerWebPart you will be able to add it to your Web part pages and play videos.

1. Download the MediaPlayerWebPart.

2. Unzip the file and copy the file MediaPlayerWebPart.dll to the bin folder on your hard drive. On Windows Server 2008 the folder is typically located in a location similar to C:\inetpub\wwwroot\wss\VirtualDirectories\www.seattlepro.com80\bin, where www.seattlepro.com is your Web site.

3. Open Notepad and load the web.config file located in the root of your Web site. For example, on Windows Server 2008 you will typically go to C:\inetpub\wwwroot\wss\VirtualDirectories\80 folder.

4. Add the following code just above the line </SafeControls>. This will add the code within the <SafeControls> and </SafeControls> section. The easiest thing is to do a search (CTRL-F) while in Notepad and look for </SafeControls>, then add the following code above that line and then save the file.

<SafeControl Assembly=”MediaPlayerWebPart, version=1.0.0.0, Culture=neutral, PublicKeyToken=4907dffeafb11512″ Namespace=”NFWebParts” TypeName=”*” Safe=”True” />

Warning! You should copy the above code from my Web site into Notepad and then copy it from your Notepad into the web.config file. Otherwise, there’s a chance that the copy command may add additional code that can mess up the results.

5. Once you’ve made the change to the web.config file, be patient while your site restarts.

6. Go to Site Actions, Site Settings, (then Modify All Site Settings for a publishing site) and under the Gallery section click Web Parts.

7. On the Web Part Gallery page click New.

8. At the bottom of the list you will find the MediaPlayerWebPart. [If you do not see it listed then check the troubleshooting section below.] Click the box next to it and then click Populate Gallery button located at the top of the page.

mpwp

9. You will see the gallery populated with the new Web part.

mpwpadded

10. At this point you have installed the new Web part and are ready to use it on your site.

Using the MediaPlayerWebPart

To use the Web part on your SharePoint site, you need to add Media Player Web Part to your Web part page.

1. Create (or open) a Web part page.

2. Add the Media Player Web Part (MPWP) located in the Misc section.

addingmpwp

3. When the MPWP is loaded, modify the shared Web part.

4. There are a couple of changes you need to make. First, add the path to the media file you want to play in Media Source box.

5. In the MediaPlayerWidth and MediaPlayerHeight boxes type an appropriate number for the size of the media player. Depending on the download speed of the network, not everyone can take advantage of larger media player size. For starters, you might want to experiment with the following numbers.

MediaPlayerWidth = 320
MediaPlayerHeight = 240

mpwpconfig

If your  video file was created in a larger format (e.g. 1024×768) then you may have to use these numbers or else your video may get cropped.

6. Click OK and exit the editing mode.

Troubleshooting Tips

Here are a few points to keep in mind if you are not able to get the Web part working properly.

1. If you are not seeing the MediaPlayerWebPart when you try to add it to your gallery it may be because you didn’t edit the correct web.config file.

2. Check the code and make sure you added it to the correct section of the web.config file.

3. Copy the code first to the Notepad from my Web site and then copy it to your web.config file to make sure that the Web page didn’t mess up the code.

4. Verify that you have added the Web part DLL to the correct bin folder.

5. If your Web part is not playing the WMV file, make sure that you have Windows Media Player installed on your computer. If you are working on the MOSS server you may not have the Windows Media Player installed.

6. If you are using Mozilla Firefox, you may need the appropriate plug-in to watch the Windows Media Player video.


Copyright ©2009 Zubair Alexander. All rights reserved.

  • Facebook
  • Twitter
  • Linkedin

10 Comments

  1. Hi Alexander,

    What a great site. Currently I have been building a website for my family to post pictures as currently we live in different areas of the world. I am using windows SharePoint 3.0

    I like to work on it on the weekends. I have recently decided that i would like to start a project with adding a Webcam to my site. I have looked everywhere for a web part; however I have not been successful. I am not a developer by any means therefore I need to use a solution that someone has created.

    Do you know of anyway that I can get a web cam streaming from my site. I have noticed a person that has a SharePoint site and is streaming a live Webcam; however there were no contact details to ask advice, and I came across this great site and thought I would drop you a line.

    Regards,

    Jamie

  2. Hi Jamie,

    You are the first person who has asked me this question. I have not looked into streaming video on a SharePoint site through a Webcam. Because of the way SharePoint uses resources, I am not sure how well that will work but you never know. I will look into this when I get a chance and if I found a solution I will post the solution and e-mail you as well. Do you happen to know the URL for the SharePoint site that’s currently streaming live Webcam?

  3. Zubair,

    Were you ever able to find anything out about the webcam streaming? We have an interest in doing something similar, so I’m trying to find out the best way to go about it.

    Thanks!

  4. I apologize for the inconvenience. My new ISP is running a Linux server which requires the URL to be case-sensitive. I have updated the URL. You should now be able to download the file. Thanks.

  5. Hi Alexander,

    The Media Player Web Part is available on the SharePoint 2007 now – so thanks for that. Is it possible to link this media player to a list to get the file name (connection is grey)? Is it possible to play streamed videos (we have them on a streaming server, mms://…)?

    I could not get a video played, but I do not know if it is a problem of the video or of the installation. It starts, but does not show anything.

    Thanks,
    Birgit

  6. Hi Alexander,

    Can you please give the code for Media player Webpart for playing .mpeg files in SharePoint 2010? I am able to play .wmv files but when I try to play .mpegs, I get an error “media failed to load”.

    Thanks a lot for Media player WP in MOSS 2007.

    Regards,
    Suresh

  7. Hi Alexander,

    The Media Player Web Part is available on the SharePoint 2007 now. I created a Web part page and used link as you’ve mentioned but the video is not coming up in IE, it’s showing black screen but it works fine in Mozilla.

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar