There is one more way to accomplish the same functionality.
Here is the way.
(1) Add content editor webpart.
(2) Click on modify shaerd webpart.
(3) Copy and paste the following content
(4)<div id="Player"> </div>
<script type="text/javascript">
function getParameter(szName)
{
// Get value out of supplied parameter
var szUrl = window.location.search;
szUrl = szUrl.toLowerCase();
szName = szName.toLowerCase();
var szValue = "";
var nBegin = szUrl.indexOf(szName);
if (nBegin != -1)
{
szValue = szUrl.substring(nBegin + (szName.length + 1));
}
var nEnd = szValue.indexOf("&");
if (szValue != "" && nEnd != -1)
{
szValue = szValue.substring(0, nEnd);
}
return szValue;
}
function wmpCreate(url) {
var str = "";
var agt = navigator.userAgent.toLowerCase();
var is_ie = (agt.indexOf("msie") != -1);
if (is_ie) {
// create the WMP for IE
str = '<object id="contentPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="800" height="640">';
} else {
// create it for FF.
str = '<object id="contentPlayer" type="application/x-ms-wmp" data="'+url+'" width="800" height="640">';
}
str += '<param name="url" value=""/>';
str += '<param name="uiMode" value="full">';
str += '<param name="autoStart" value="-1" />';
str += '<param name="stretchToFit" value="-1" />';
str += '<param name="windowlessVideo" value="0" />';
str += '<param name="enabled" value="-1" />';
str += '<param name="enableContextMenu" value="-1" />';
str += '<param name="fullScreen" value="0" />';
str += '</object>';
return str;
}
function videoCreate() {
document.getElementById('Player').innerHTML = wmpCreate();
var wmp = document.getElementById('contentPlayer');
wmp.URL = getParameter("url");
wmp.controls.play();
}
_spBodyOnLoadFunctionNames.push("videoCreate");
</script>
(5)If you feel its too big for page to fit in, then modify Width and Height in this line :
str = '<object id="contentPlayer" type="application/x-ms-wmp" data="'+url+'" width="800" height="640">';
(6)Save your media files in some document library and use its url as parameter on page where you have placed this webpart. This webpart will fetch the parameter as "url" and its value and play in media player.
Enjoy watching movie and songs on your sharepoint site!!!!
Above Code - Updated on 26-Jun-09
Requirment: To Display a Video stored in a Document Library.
Solution: Create a Document Library Eg. Sample001
Upload a video file
Eg: “MediaPlayerSample.avi”
Just add a content editor web part
Edit the webpart, use the below HTML in the “Source Editor…”
Note: in the above HTML code, the only parameter to set is the "animationatStart".
Click on the Below image, and see the parameter VALUE.
3 comments:
Hello - thank you for the great information. Could you provide an example of how to set the url parameter on the page?
Anybody from the sharepoint kings team
can i share this code purely for knowledge sharing purposes with my team. Just to give them an idea that this can be done.
Is it under creative commons licensing.
@ Anonymous above
http://xyz.com/pages/abc?url = "http://xyz.com/list/movie.wmv"
the part after the ? is the parameter
Hay Anonymous, Thanks for answer.
You can use any code publish on the site.
Post a Comment