Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is the MediaElement not playing a MediaStreamSource (in SilverLight)?
    primarykey
    data
    text
    <p>When I try to stream sound from my microphone, I need to get it through a <code>MediaStreamSource</code>. Therefore I first need to implement a <code>MediaStreamSource</code> for the pcm waveformat I get from my Microphone. There are at least two methods I think I need to implement. At first</p> <pre><code>protected override void OpenMediaAsync() { // Create description Dictionary&lt;MediaStreamAttributeKeys, string&gt; streamAttributes = new Dictionary&lt;MediaStreamAttributeKeys, string&gt;(); streamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = output.CodecPrivateData; audioDesc = new MediaStreamDescription(MediaStreamType.Audio, streamAttributes); // register stream Dictionary&lt;MediaSourceAttributesKeys, string&gt; sourceAttributes = new Dictionary&lt;MediaSourceAttributesKeys, string&gt;(); List&lt;MediaStreamDescription&gt; availableStreams = new List&lt;MediaStreamDescription&gt;(); availableStreams.Add(audioDesc); sourceAttributes[MediaSourceAttributesKeys.Duration] = TimeSpan.FromMinutes(0).Ticks.ToString(); // whatever I put here I get the same result. sourceAttributes[MediaSourceAttributesKeys.CanSeek] = false.ToString(); ReportOpenMediaCompleted(sourceAttributes, availableStreams); } </code></pre> <p>This works very well. My CodecPrivateData is '01000100401F0000803E0000020010000000' (PCM 1ch 16Bits 8kHz). This method gets called by setting the source as here:</p> <pre><code>WaveMediaStreamSource WaveStream = new WaveMediaStreamSource(output); mediaElement.SetSource(WaveStream); mediaElement.Play(); </code></pre> <p>After <code>Play()</code> absoultely nothing happens. I would suggest the mediaElement should call at least once the method <code>GetSampleAsync()</code> of the <code>MediaStreamSource</code>. But it doesn't. I've noticed that the <code>MediaElement</code> doesn't make any call to the <code>MediaStreamSource</code> anymore.</p> <p>While <code>OpenMediaAsync</code> the <code>mediaElement.CurrentState</code> is <code>Opening</code>. After that it turns to <code>Playing</code> but it doesn't play. And then it do not change anymore and remains <code>Playing</code>.</p> <p>Any Ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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