Share via


SmoothStreamingMediaElement.MergeExternalManifest Method

Replaces some elements of the main manifest with others from an external manifest or adds new elements to the main manifest.

Namespace:  Microsoft.Web.Media.SmoothStreaming
Assembly:  Microsoft.Web.Media.SmoothStreaming (in Microsoft.Web.Media.SmoothStreaming.dll)

Syntax

'Declaration

Public Sub MergeExternalManifest ( _
    externalManifest As Object _
)
'Usage

Dim instance As SmoothStreamingMediaElement
Dim externalManifest As Object

instance.MergeExternalManifest(externalManifest)
public void MergeExternalManifest(
    Object externalManifest
)
public:
void MergeExternalManifest(
    Object^ externalManifest
)
member MergeExternalManifest : 
        externalManifest:Object -> unit 
public function MergeExternalManifest(
    externalManifest : Object
)

Parameters

  • externalManifest
    Type: System.Object
    An object that represents the external manifest, as returned by the Microsoft.Web.Media.SmoothStreaming.SmoothStreamingMediaElement.ParseExternalManifest method.

Remarks

For more information and for examples, see Manifest Merge.

Examples

Applications can call MergeExternalManifest only from the ManifestMerge event handler. Outside the scope of this method, MergeExternalManifest throws an InvalidOperationException.

The MergeExternalManifest method integrates data in the client manifest with new XML data specified by the externalManifest parameter, which is the parsed data obtained from a previous call to ParseExternalManifest.

The following example shows how to use the method to assign a delegate.

 SmoothPlayer.ManifestMerge += 
    new SmoothStreamingMediaElement.ManifestMergeHandler(SmoothPlayer_ManifestMerge);

The following example shows an implementation of the SmoothPlayer_ManifestMerge delegate that includes options to load supplementary manifest data from sources represented by the mediaSelection variable, which is an integer assigned when the source is selected. The methods that load the new data can load manifest data from two sources and initialize the parsedExternManifest and parsedExternManifest2 objects. For more information, see Manifest Merge.

    void SmoothPlayer_ManifestMerge(SmoothStreamingMediaElement ssme)
    {
        // Out parameter for ParseExternalManifest function.
        object parsedExternManifest = null;
        object parsedExternManifest2 = null;

        try
        {
            if (mediaSelection.Equals(0))
            {
                Uri uriExtManifest = new Uri("http://<serverName>/BigBuckBunnyCaptions.xml");
                SmoothPlayer.ParseExternalManifest(uriExtManifest, 3000, out parsedExternManifest);
                SmoothPlayer.MergeExternalManifest(parsedExternManifest);
            }

            if (mediaSelection.Equals(1))
            {
    
                Uri uriExtManifest = new Uri("http://<serverName>/AdrenalineRush.xml");
                SmoothPlayer.ParseExternalManifest(uriExtManifest, 3000, out parsedExternManifest);
                SmoothPlayer.MergeExternalManifest(parsedExternManifest);

                Uri uriExtManifest2 = new Uri("http://<serverName>/AdrenalineRushCaptions.xml");
                SmoothPlayer.ParseExternalManifest(uriExtManifest2, 3000, out parsedExternManifest2);
                SmoothPlayer.MergeExternalManifest(parsedExternManifest2);
            }
        }
        catch(Exception ex )
        {
            OutputText.Text = ex.Message + " Inner Exception: " + ex.InnerException;
        }
    }

Version Information

Silverlight

Supported in: 5

See Also

Reference

SmoothStreamingMediaElement Class

Microsoft.Web.Media.SmoothStreaming Namespace