Note that there are some explanatory texts on larger screens.

plurals
  1. POPlaying two audio streams simultaneously
    text
    copied!<p>I am going to write an application that will play two audio streams simultaneously from an HTTP streaming server. Before I begin, I want to be sure whether the Windows Phone devices and API supports this.</p> <p>I guess I'll have to use two instances of MediaElement's. Any ideas or suggestions?</p> <p>Edit: I tried it with the following code, and the first one stops and second one plays, when I start the second one while the first one is playing:</p> <pre><code> private void StopMedia1(object sender, RoutedEventArgs e) { media1.Stop(); } private void PauseMedia1(object sender, RoutedEventArgs e) { media1.Pause(); } private void PlayMedia1(object sender, RoutedEventArgs e) { media1.Play(); } private void StopMedia2(object sender, RoutedEventArgs e) { media2.Stop(); } private void PauseMedia2(object sender, RoutedEventArgs e) { media2.Pause(); } private void PlayMedia2(object sender, RoutedEventArgs e) { media2.Play(); } &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;MediaElement x:Name="media1" Source="1.mp3" Margin="0,151,0,359" /&gt; &lt;MediaElement x:Name="media2" Source="2.mp3" Margin="0,154,3,359" Grid.Column="2" /&gt; &lt;!-- Stops media playback.--&gt; &lt;Button Click="StopMedia1" Content="Stop" Margin="6,449,24,244" /&gt; &lt;!-- Pauses media playback. --&gt; &lt;Button Click="PauseMedia1" Content="Pause" Margin="0,538,24,143" /&gt; &lt;!-- Begins media playback. --&gt; &lt;Button Click="PlayMedia1" Content="Play" Margin="0,649,0,47" /&gt; &lt;Button Click="PauseMedia2" Content="Pause" Grid.ColumnSpan="2" Margin="154,524,6,169" Grid.Column="1" /&gt; &lt;Button Click="PlayMedia2" Content="Play" Grid.Column="2" Margin="0,612,12,59" /&gt; &lt;Button Click="StopMedia2" Content="Stop" Margin="18,429,12,264" Grid.Column="2" /&gt; &lt;/Grid&gt; </code></pre> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload