Persist Silverlight MediaElement playing on ASP.NET postback
I am trying to figure out how to persist the playing of a Silverlight MediaElement playing within a Silverlight User Control embedded in an ASP.NET during postback.
The scenario goes:
Have a media player on a site, press play, continue navigating through site while the music continues playing.
What it does right now: Obviously the object gets loaded anew on each postback or page redirect (even if it's back to the same page IE: default.aspx).
I've seen samples of how to persist the state of a Control on postback and even complex data through cross-page postback. But nothing that covers my specific case.
Other particulars: Silverlight 2 ASP.NET C#
My default.aspx:
<html>
</head>
</head>
<body>
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/RickBainAudioPlayer.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="3.0.40624.0" /&开发者_如何学运维gt;
<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>
</form>
</body>
</html>
The only way I know of to do this is rather old hat. Use HTML Frames. Place the silverlight application that plays the media in one framw and place the rest of your site in the main frame.
精彩评论