Compartir a través de


Troubleshooting Media Issues

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This topic describes how to diagnose and solve media issues in Silverlight.

MediaStreamSource Issues

This section covers MediaStreamSource issues resulting from the following situations: MediaFailed events, MediaEnded events, and SetSource method calls being ignored, and audio/video (AV) sync issues.

Possible Reasons for Missing MediaFailed Events

  • A MediaStreamSource method may have raised an unhandled exception, such as by accessing a UI element property from a non-UI thread.

    Developers should consider wrapping their handlers in try/catch statements that log exceptions. To show the log, developers can add a periodic timer on the UI thread to update the display, or post a delegate to the UI thread as shown in the following code:

    Dispatcher.BeginInvoke( ( ) => {TextBox.Text += “Message Text\n”; } );
    
  • The CodecPrivateData format may not be recognized.

    For more information, see the Delivering and Accessing Media Content and Implementing MediaStream Sources topics.

  • The codec is not supported by the Windows Phone emulator (H.264 and AAC fall into this category).

  • The codec is supported by the Windows Phone emulator, but Zune is running. WpConnect should be used instead to debug media applications.

  • In Silverlight for Windows Phone, a maximum of one MediaElement with video may be in a non-closed state at any given time.

Possible Reasons for MediaEnded Events

  • One of the streams may not have reported an end-of-stream sample.

  • One of the streams may have a sample with a timestamp in the far future.

    All sample must been rendered for the media to have ended.

  • A zero-byte sample may have been reported. This can confuse the pipeline.

Possible Reasons for SetSource Being Ignored

Possible Reasons for AV Sync Issues

  • CPU utilization may be excessive.

    This can occur if a large number of network requests are made simultaneously.

  • The key frame flag may be reported on audio samples.

    Setting key frame on audio samples causes the pipeline to consider the sample to be reporting a discontinuity. Since the presence of the key frame flag indicates it is a key frame, the value "false" is treated the same as "true".

  • Starvation has occurred.

    To prevent starvation from occurring, call the ReportGetSampleProgress method instead of allowing the audio or video pipeline buffer to drain completely.

  • Seek took an excessive time.

    In Silverlight for Windows Phone, an excessive time between SeekAsync and ReportGetSampleCompleted can cause this seek delay. Instead of buffering during SeekAsync, consider calling ReportGetSampleCompleted quickly. Then wait for the first GetSampleAsync request to respond with ReportGetSampleProgress and begin buffering.

Proxy Servers Guidance for Users

In networks where a proxy server exists, special settings on the client may be required before streaming will work in Silverlight. In general, Silverlight looks at system settings only to make a decision about proxy server configuration. Therefore, specifying a proxy setting in Mozilla Firefox, which has its own proxy settings distinct from the operating system, will not affect the way streaming works in either Windows or Macintosh platforms.

Windows: End users need to make sure that they have the correct proxy settings under Internet Options. These options can be accessed through Internet Explorer, or directly from the Control Panel. In Windows, users should be able to use automatic proxy detection, specify a configuration script, or manually specify the proxy server IP address to enable streaming in Silverlight. As a result, as long as users are able to browse the Web using Internet Explorer, streaming in Silverlight should work correctly. Even if users are able to browse the Web using Firefox (that is, if Firefox proxy settings are correct), there is a chance that streaming will not work if the system settings are not also correct.

Macintosh: End users need to make sure that they manually specify the proxy servers IP address under Network Preferences. These settings can be accessed through Safari, or directly from System Preferences. Unlike Windows, specifying a PAC configuration script for the proxy server is not supported for Silverlight 1.0. As a result, there is a chance that a user may able to browse the Web correctly, without being able to stream media in Silverlight. This could occur if the system settings are using a configuration script for proxy detection, or if the system settings are incorrect but Firefox is being used (and Firefox proxy settings are correct).