Calling dynamic data to media source


  • I am trying to build a silverlight player and want the source of the mediaelement to be called from xml or a database. I am using c# as my code behind, can anyone give me some good ideas as how I would go about doing this?

    I have tried calling a php file that emmits xml, echo's a complete url and etc....


    Thanks for you help in advanced.

    Monday, July 25, 2011 6:20 PM


All replies

  • Hi Rsexton1980,

    Please have a look at below sample:

    Media item data stored in XML document file. Please have a try.

    Best Regards,

    Wednesday, July 27, 2011 9:57 PM
  • Hi Haixia Xie,


     Thanks for the link, but that's not what I am looking for. It doesn’t help me with the Silverlight application aka mediaPlayer. I need to know how the mediaPlayer interacts with the defalut.aspx or default.aspx.cs file. I already understand the concept on opening and reading xml data, that's easy. I know how to use an array to get and make a list selection, list drop down menu and such... But I cannot get how to link it to the defalut.aspx or the default.aspx.cs


    Again Thanks for your help.

    Thursday, July 28, 2011 11:47 PM
  • Hi Rsexton1980,

    In above link, it is a custom Silverlight media player, if you just want create a Silverlight application with the source of the MediaElement to be called from xml, as you said above, reading data from xml that would not that complex.

    And if you want get MediaElement source from database, you can use WCF Services or WCF RIA Services, there are two links explain how to get datas from database using services:

    Hope it may help.

    Best Regards,

    Friday, July 29, 2011 7:03 AM
  • Thanks Haixia Xie,


    That didn't help, I dont want to embed the database or call from the application it's self. I want the default.aspx or default.aspx.cs to call it. I want the silverlight application to call the default.aspx or default.aspx.cs like below. If you look at you will see the player I found that does what I want it to do. But I have a custom built player that needs to do a lot of things...


    <div id="silverlightcontainer" class="auto-style1">
    		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="1010" height="400">
    			<param name="source" value="silverlight/mediaPlayer.xap"/>
    			<param name="background" value="white" />
    			<param name="minRuntimeVersion" value="2.0.31005.0" />
    			<param name="autoUpgrade" value="true" />
    			<param name="InitParams" value="selectedcaptionstream=textstream_eng,mediaurl=" />
    <a href="" style="text-decoration: none;">
    			<img src="" alt="Get Microsoft Silverlight" style="border-style: none;"/>
    		<iframe id="I1" style='visibility:hidden;height:0;width:0;border:0px;' name="I1">
    Thank you for your help.
    Friday, July 29, 2011 1:27 PM
  • I found what I was looking for. Here is the link that i needed. Cool

    So the way I am doing this is as follows...

    I use the code behind to open the xml. Then use DataBind() to a variable that is retrieved on the aspx page.

    I found everything I needed to complete the project...




    I will be uploading xap file once I finish the story board.

    you for your help Haixia Xie, you had a vast amount of information.




    Saturday, July 30, 2011 4:11 AM
  • i've the same problem,, do u solve the problem yet?

    cause ive project example,, but its using SL2 version + VS2008,,

    in that version they using internal file (abc.xaml + abc.xaml.js + silverlight.js) in 1 same folder with ur website..

    I can not implement it in the new version of silverlight T_T

    Wednesday, September 28, 2011 3:17 AM