Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

How to move SL2 asp:MediaPlayer to SL3 with no depedenc... RSS

3 replies

Last post Aug 04, 2009 08:27 AM by Jonathan Shen – MSFT

(0)
  • carlsjf

    carlsjf

    Member

    6 Points

    21 Posts

    How to move SL2 asp:MediaPlayer to SL3 with no depedency on SL2 DLL?

    Jul 29, 2009 05:24 AM | LINK

    Because SL3 removes the asp.net control, I now need to modify previous code for SL3. But I don't like to carry the 'System.Web.Silverlight.dll' with it.

    Now there is much document for modifying asp:silverlight control to SL3.  (the typical code as follows)

    <div id="silverlightControlHost">
            <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
        <param name="source" value="....xap"/>
        <param name="onError" value="onSilverlightError" />
        <param name="background" value="white" />
        <param name="minRuntimeVersion" value="3.0.40624.0" />
        <param name="autoUpgrade" value="true" />
        <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
          <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
        </a>
         </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div> 

    BUT how to do in the similar way for modifying the mediaplayer?

     Thanks.

    MediaPlayer

  • MarkMonster

    MarkMonster

    Star

    7622 Points

    1505 Posts

    Re: How to move SL2 asp:MediaPlayer to SL3 with no depedency on SL2 DLL?

    Jul 29, 2009 07:54 AM | LINK

    I don't know about the asp:MediaPlayer, but can you post what you'll get in the rendered html that's received in the browser? We should be able to rewrite this to a similar structure as above.
    Mark Monster - Silverlight MVP - MCPD Enterprise
    Blog
    Silverlight and Expression Insiders UG

    Dont forget to click "Mark as Answer" on the post that helped you.
  • carlsjf

    carlsjf

    Member

    6 Points

    21 Posts

    Re: How to move SL2 asp:MediaPlayer to SL3 with no depedency on SL2 DLL?

    Jul 29, 2009 11:50 AM | LINK

    Thank you very much! 

    asp:mediaplayer is used as :

    <asp:MediaPlayer ID="MediaPlayer1" runat="server" AutoPlay="true" ScaleMode=Stretch  
                            Width="170px" Height="120px" AutoLoad="true" Windowless=true
                             MediaSkinSource="~/MediaPlayerSkins/Skin_Simple.xaml"
                            MediaSource="HomePageVideo.wmv" 
                            PlaceholderSource="~/Images/Logo.jpg"  HtmlAccess="Enabled"
                            SplashScreenSource="Images/Logo.jpg"  >
                        </asp:MediaPlayer>

    the rendered result of above asp:mediaplayer just like following:

    ...... 

    <span id="ctl00_Main_MediaPlayer1_parent"></span>
    <script type="text/javascript">

    //<![CDATA[
    Sys.UI.Silverlight.Control.createObject('ctl00_Main_MediaPlayer1_parent', '<object type="application/x-silverlight" data="data:application/x-silverlight," id="ctl00_Main_MediaPlayer1" style="height:120px;width:170px;">\r\n\t<param name="EnableHtmlAccess" value="True">\r\n\r\n\t</param><param name="Windowless" value="True">\r\n\r\n\t</param><a href="http://go2.microsoft.com/fwlink/?LinkID=114576&amp;v=1.0" mce_href="http://go2.microsoft.com/fwlink/?LinkID=114576&amp;v=1.0"><img src="http://go2.microsoft.com/fwlink/?LinkID=108181" mce_src="http://go2.microsoft.com/fwlink/?LinkID=108181" alt="获取 Microsoft Silverlight" style="border-width:0;" /></a>\r\n</object>');
     //]]>
    </script>
    ......

     Sys.Application.add_init(function() {
        $create(Sys.UI.Silverlight.MediaPlayer,   {"autoPlay":true,"mediaSource":"HomePageVideo.wmv","placeholderSource":"Images/Logo.jpg","scaleMode":2,"source":"MediaPlayerSkins/Skin_Simple.xaml","splashScreenSource":"Images/Logo.jpg"}, null, null, $get("ctl00_Main_MediaPlayer1_parent"));
    });
    ......

     

     

    MediaPlayer

  • Jonathan Shen – MSFT

    Jonathan She...

    All-Star

    50156 Points

    4951 Posts

    Microsoft

    Re: How to move SL2 asp:MediaPlayer to SL3 with no depedency on SL2 DLL?

    Aug 04, 2009 08:27 AM | LINK

    Hi Carlsjf,

    MediaPlayer had been removed since we released Silverlight 3. Actually, asp.net MediaPlayer is Javascript based.  Now, we can use MediaElement which is contained inside Silverlight.  However, it is recommend to use Blend + Encoder to get your our own MediaPlayer.  Microsoft has provided some templates.  Also, funs provided their brilliant works.  For example,  Silverlight Media Player .

    Best regards,

    Jonathan  

    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework