manipulate mediaplayer in c# for streaming video

Topics: Windows 8 Xaml
Jul 23, 2012 at 3:35 PM
Edited Jul 23, 2012 at 3:49 PM

Sounds like it doesn't allow put two media player(for streaming video) tags in xaml in the same page. Can I use c# to create the meida player instance and add it in the run time for the streaming video? That way, we don't need to add any media player tags in the xaml to avoid the problem. (The problem I met is in when change to snapped view, the app crashed)

The markup for media player in the xaml is like below:

<mmppf:MediaPlayer Name="EmbedVideo0" Source="{Binding Video}" Width="480"  Height="320" AutoPlay="False" >
   <mmppf:MediaPlayer.Plugins>
       <adaptive:AdaptivePlugin />
   </mmppf:MediaPlayer.Plugins>
</mmppf:MediaPlayer>

If I create an instance of MediaPlayer, how can I add the adaptive plugin? Does the code below work? Is there any sample c# code?

MediaPlayer mp = new MediaPlayer();
AdaptivePlugin p = new AdaptivePlugin();
mp.Plugins.Add(p);

Thanks.

Frank

 

Coordinator
Jul 24, 2012 at 2:44 PM

Hi Frank, the smooth streaming SDK only supports one active instance at a time. You could have two instances created but you'll need to null out the source of one before using the other.

Let me know if you have further questions,

Tim