This topic describes the formats and protocols supported by the MediaElement object. It also describes the MediaElement object's support for streaming and stream selection.
This topic contains the following sections.
Container: Also called a “wrapper format”, stores the media data and the information about how this data is stored within the container.
Codec: See video codec and audio codec below.
Delivery Method: How the media is delivered to users.
Video Codec: A device or software that enables video compression and/or decompression for digital video.
Audio Codec: A device or software that enables audio compression and/or decompression for digital audio.
Progressive Download: Delivers media by playing the downloaded portion of a file while the download is still in progress.
Traditional Streaming: Delivers and presents media without first storing it.
Smooth Streaming: Like traditional streaming except that it enables streaming to scale depending on user's hardware and network connection. This is provided by IIS 7.0 server.
Raw Video: Video in a raw or unencoded format. Typically this is content which has been captured which could be in a format such as RGBA or YV12.
Raw Audio: Audio in a raw or unencoded format. Typically this is content which has been captured as linear PCM samples.
H.264 (ITU-T H.264 / ISO MPEG-4 AVC): a standard for video compression, and is equivalent to MPEG-4 Part 10.
Server Side Play List (SSPL): See Server-Side Playlists.
ASX: Client side playlists. See "Play Lists" below.
Delivery Method, Containers, and Codecs
In order to deliver content to users, you must first decide:
Delivery Method: How are you going to get your media to users? For example, do you want to use smooth streaming, traditional streaming, etc.
Container: What are you going to contain the media in? For example, an MP3, MP4, etc.
Codec: What codec do you want to use to encode your media? For example, H264-AACLC, MP3, etc.
The following tables help you determine what options you have for delivering content using Silverlight. The first table specifies what containers can be sent using what delivery method, the second table specifies what codecs you can use for given containers.
Supported Containers by Delivery Method
Delivery Method | Supported Containers |
|---|
Progressive Download | Windows Media, MP4, MP3, ASX |
Windows Media Streaming over HTTP | Windows Media, Server Side Play List (SSPL) |
Smooth Streaming (Specific type of MediaStreamSource) | fMP4 |
ASX | Windows Media, MP4, ASX |
Server Side Playlist | Windows Media |
MediaStreamSource | MediaStreamSource gives the developer complete control over the container. Any container can be used as long as the developer writes or uses a parser for it. |
Now that you have decided which container to send using your desired delivery method, you must decide which codec to use to encode your media into the container.
Supported Codecs of Container
Container | Codec |
|---|
Windows Media | "353" - Microsoft Windows Media Audio v7 v8 and v9.x Standard (WMA Standard) "354" - Microsoft Windows Media Audio v9.x and v10 Professional (WMA Professional) WMV1 (Windows Media Video 7) WMV2 (Windows Media Video 8) WMV3 (Windows Media Video 9)
|
MP4 | H.264 (ITU-T H.264 / ISO MPEG-4 AVC), AAC-LC |
MP3 | "85" - ISO MPEG-1 Layer III (MP3) |
Below is a rollup list of formats supported by the MediaElement. These encodings are supported regardless of the file name extension.
Video
Raw Video
YV12 - YCrCb(4:2:0)
RGBA - 32 bit Alpha Red, Green, Blue
WMV1: Windows Media Video 7
WMV2: Windows Media Video 8
WMV3: Windows Media Video 9
Supports Simple and Main Profiles.
Supports only progressive (non-interlaced) content.
WMVA: Windows Media Video Advanced Profile, non-VC-1
WVC1: Windows Media Video Advanced Profile, VC-1
Supports Advanced Profile.
Supports only progressive (non-interlaced) content.
H264 (ITU-T H.264 / ISO MPEG-4 AVC)
Supports H.264 and MP43 codecs.
Supports Base, Main, and High Profiles
Supports only progressive (non-interlaced) content.
Supports only 4:2:0 chroma subsampling profiles.
Audio
“1”. This is Linear 8 or 16 bit Pulse Code Modulation. Roughly speaking, this is WAV format.
"353" - Microsoft Windows Media Audio v7, v8 and v9.x Standard (WMA Standard)
"354" - Microsoft Windows Media Audio v9.x and v10 Professional (WMA Professional)
Supports full fidelity decoding of WMA 10 Professional Low Bit Rate (LBR) modes in the 32-96 kbps range.
Multichannel (5.1 and 7.1 surround) audio content is automatically mixed down to stereo.
24 bit audio will return silence.
Sampling Rates beyond 48000 return an invalid format error code in same-domain and a 4001 in cross-domain scenarios.
"85" - ISO MPEG-1 Layer III (MP3)
"255" - ISO Advanced Audio Coding (AAC)
Supports Low Complexity (AAC-LC) decoding at full fidelity (up to 48 kHz).
High Efficiency (HE-AAC) encoded content will decode only at half fidelity (up to 24 kHz).
Multichannel (5.1 surround) audio content is not supported.
The following formats are not supported:
Interlaced video content
Windows Media Screen
Windows Media Audio Professional
Windows Media Voice
Combination of Windows Media Video and MP3 (WMV video + MP3 audio)
Combination of WMV with AAC-LC
VC-1 in MP4
The following Web protocols/schemes are supported (see also URL Access Restrictions in Silverlight):
http
https
ms-wmsp (You can use the mms and rtsp monikers, but it will fall back to http-streaming also know as ms-wmsp.)
UNC (e.g. \\computer_name\share_location). Note that you cannot set MediaElement.Source = UNC. What you have to do instead is get a Stream open to the UNC and then use MediaElement.SetSource(stream) where stream is the stream opened from that UNC. Also note that you may experience performance issues if you attempt to play large files over a UNC because the entire file must be downloaded before playback can begin.
Playlists
A server-side playlist (SSPL), as it is available for Silverlight, is a sequence of media elements (either audio or video) that allows server administrators to control the sequence of streaming media viewed by the user as well as other behaviors. This playlist can be created statically or dynamically. A server-side playlist can be used to serve media for either on-demand or broadcast streams. For more information, see Server-Side Playlists.
MediaElement also supports playlists in the form of Advanced Stream Redirector (ASX) files, also known as Windows Media metafiles. Although the file name extension does not matter, these files typically have the .asx, .wax, .wvx, .wmx, or .wpl extension. For more information about these file types, see Windows Media Metafiles.
Note: |
|---|
The following features of ASX files are not supported in Silverlight. |
ASX feature | Description |
|---|
PreviewMode Attribute | This attribute is found on the root ASX object. It is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ATTRIBUTE. |
BannerBar Attribute | This attribute is found on the root ASX object. It is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ATTRIBUTE. |
SkipIfRef | This attribute is found on the root ENTRY object. It is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ATTRIBUTE. |
REPEAT Element | This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT. |
EVENT Element | This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT. |
STARTMARKER Element | This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT. |
ENDMARKER Element | This is not supported and will raise a MediaError with AG_E_ASX_UNSUPPORTED_ELEMENT. |
Invalid content | If a valid ASX tag has content that is not accepted (for example, a MOREINFO tag contains a REF tag), a MediaFailed error is raised. |
Fallback URLs | If an ENTRY tag has multiple REF children, only the first one is read. Unlike WMP, Silverlight will not attempt to open additional REF URLs in case the first one fails, and a MediaFailed error is raised. |
For more information on ASX elements, see ASX Elements Reference.
In addition to progressive downloads, MediaElement supports live and on-demand streaming from a Windows Media Server. If the media Uniform Resource Identifier (URI) specifies the mms scheme, the MediaElement attempts to stream the file first. If the file cannot be streamed, it downloads the file progressively. If the media URI specifies another scheme, such as http or https, the MediaElement attempts a progressive download first. If that fails, the MediaElement attempts to stream the file.
Note that live streaming media cannot be paused; calling the Pause method has no effect.
To find out more about the differences between streaming and progressive downloading, see Key Concepts in Windows Media Technologies in the MSDN online library.
Proxy Servers and Streaming in Silverlight
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 Firefox 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 happen 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).
Supported Fields of Server Logs
A server administrator might want to get information about Silverlight client connections to their servers, particularly related to streaming media. This can be done by accessing logs on the server; however, the information in these logs is determined by what information the Silverlight client sends to the server. The following table shows the supported log fields reported by Silverlight.
Field name | By | When | Unit & length | Description | Sample value |
|---|
c-ip | Server | Begin | IP Address 50 chars | The source IP address of the connected socket. This may end up being the IP of a proxy server or firewall. | 157.100.200.300 (server) |
Date | Server | Begin | Date 10 chars | The server’s date when the client connected to the stream. This is either in UTC or local time depending upon the plug-in configuration. Refer to the log file’s headers to determine if this value is based on UTC or local time. | 1997-10-09 (server) |
Time | Server | Begin | Time 8 chars | The server’s time when the client connected to the stream. This is either in UTC or local time depending upon the plug-in configuration. | 15:30:30 (server) |
cs-uri-stem | Client | Begin | URL path 4096 chars | The path to what the client requested. This is the requested URL without the schema, host, port number, or query string. | /test/sample.asf |
x-duration | Client | End | Seconds 10 chars | Time (in seconds, no fractions) that the client has been rendering received data. Time buffering data is not included in this value. | 31 |
c-status | Client | Dynamic | HTTP Result 8 chars | Codes that describe the client's status. Mapped to http/rtsp status codes. Silverlight should always return 200. | 200 |
c-playerid | Client | Begin | GUID 38 chars | GUID for the client’s player. Silverlight always returns an anonymous GUID of the form {3300AD50-2C39-46c0-AE0A-xxxxxxxxxxxx}, where x is the server’s session id (refer to the s-sessionid field). | {3300AD50-2C39-46c0-AE0A-70B64F321A80} |
c-playerversion | Client | Begin | String 64 chars | The player version number. Silverlight will always return the version of NetSource being used. | 11.08.005.0000 or similar. |
cs(User-Agent) | Client | Begin | String 256 chars | If the player was embedded in a browser, this field refers to the browser type that was used, appended by the version of NetSource used, and the version of Silverlight installed on the system. | Mozilla/4.0_(compatible;_MSIE_4.01;_Windows_98)_NSPlayer/6.4.1.2_Silverlight/1.0.20926.0 |
cs(Referer) | Client | Begin | URL 4096 chars | URL to the Web page that the player was embedded within (if the player was embedded). | http://www.contoso.com/default.htm |
c-os | Client | Begin | String 64 chars | Client computer's operating system (for example, Windows 95, Windows NT/2000/XP, Apple Macintosh). | One of: Windows_2000, Windows_XP, Windows_Vista, MacOS. |
filelength | Server | Begin | Seconds 10 chars | Length of the ASF file (in seconds) for on-demand and broadcast streams sourced from a file. For a live broadcast stream, this value is undefined and represented as zero (0). | 60 |
filesize | Server | Begin | Bytes 10 chars | Size of the ASF file (in bytes) for on-demand and broadcast streams sourced from a file. For a live broadcast stream, this value is undefined and represented as zero (0). | 86000 |
Avgbandwidth | Server | End | Bits per second 10 chars | Average bandwidth (in bits/sec) at which the client was connected to the server. This is the average across the entire duration of the connection. | 102585 |
protocol | Server | Begin | String 16 chars | The protocol used to access the stream. Silverlight should always return http or https for this field, because it’s the only currently supported protocol. | http |
transport | Server | Begin | String 16 chars | The transport used to deliver the stream, either UDP, TCP, or multicast. Silverlight should always return TCP. | TCP |
sc-bytes | Server | End | Bytes | Total number of data bytes the server sent to the client. This does not include any TCP/IP or other overhead that is added by the network stack. | 1188557 |
c-bytes | Client | End | Bytes 10 chars | Number of bytes received by the client from the server. This does not include any TCP/IP or other overhead that is added by the network stack. | 28000 |
s-pkts-sent | Server | End | ASF Packets 10 chars | Number of packets sent by the server. This value represents the number of ASF data packets (not TCP or UDP packets). | 55 |
c-quality | Client | End | Percent (%) 3 chars | The measure of how well the stream was received by the client (on a scale from 0 to 100%). This is reported by NetSource. | 89 |
s-ip | Server | Begin | IP Address 35 chars | Upstream server IP address. This is the server that received the log. | 155.12.1.234 |
s-dns | Server | Begin | DSN addr. 255 chars | Upstream server DNS. This is the server that received the log. | wmt.contoso.com |
s-totalclients | Server | End | Connected clients 10 chars | Number of clients connected to the upstream server at the time of the logging event. | 201 |
s-cpu-util | Server | End | Percentage 3 chars | CPU load on the upstream server (0-100%) at the time of the logging event. | 40 |
cs-user-name | Server | Begin | String 256 chars | This is the user name that the client provides the server during authentication. | Empty |
s-session-id | Server | Begin | Session 10 chars | This is an internal session ID that the server uses to track a given client session. This is important to track multiple log entries to the same session. Using the client GUID to track a session across multiple log entries is not manageable because it is possible to have multiple instances of a client running on a machine at one time (the GUID for each log entry may be identical). | 123456 |
s-content-path | Server | Begin | URL 4096 chars | This is the actual content object that was streamed to the client. A plug-in may resolve a requested path to a path differently than what a client requested. | http://www.contoso.com/speech.wma |
cs-url | Client | Begin | URL 4096 chars | The actual URL requested by the client. | mms://contoso.com/some/content.asf |
cs-media-name | Client | End | String 256 chars | The name of the stream the client was playing, without the full path. | myVideoFile.wmv |
s-proxied | Server | End | Boolean 1 char | Indicates whether the connection was made through a cache/proxy server or not. This value is 0 if there was no cache/proxy server involved. The value is 1 if a cache/proxy server was involved. Even if a cache/proxy server downloads content into cache, this value will be 1 because a cache/proxy server was involved with the connection. This value is triggered by the existence of a "Via" protocol header. This enables HTTP based (non-streaming) proxy servers to be identified. Note that any remote client log will have a 1 value for this field. However a client that has locally cached content may propagate the remote log directly to the origin server without passing through a cache/proxy server. In this case, the value will be 0. | 0 |
Digital Rights Management (DRM)
Integrating Digital Rights Management into your Silverlight applications allows you to protect and securely deliver streaming or progressive download content for cross-platform playback. For more information, see Digital Rights Management (DRM).
Reference
Concepts
Other Resources