Compartir a través de


IWMSCacheProxyServerCallback.OnDownloadContentFinished (Visual Basic .NET)

The OnDownloadContentFinished method is called by the server when media items have finished downloading to the cache.

IWMSCacheProxyServerCallback.OnDownloadContentFinished(  lHr As Integer,
  psaArchiveContexts As Object[],
  varContext As Object
)

Arguments

[in] Integer indicating whether the call to IWMSCacheProxyServer.DownloadContent succeeded.

[in] Array of Objects containing one or more archive contexts. When a single on-demand file is downloaded, the array will contain one context. When multiple items in a playlist are downloaded, the array will contain a context for each item, and the first entry will contain an archive context describing the entire playlist.

[in] Object containing a value defined by the plug-in when it called IWMSCacheProxyServer.DownloadContent. For example, your plug-in can use this parameter to persist state information. The server does not alter this value and passes it back when calling OnDownloadContentFinished.

Return Value

This method does not return a value. To report an error, the plug-in can throw a COMException object to the server. If the plug-in uses the IWMSEventLogIWMSEventLog Object (C#) to log error information, it is recommended that it throw NS_E_PLUGIN_ERROR_REPORTED (0xC00D157D). Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog object to send custom error information to the Windows Event Viewer, throwing NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about plug-in error information, see Identifying Plug-in Errors.

Example

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Public Sub OnDownloadContentFinished(ByVal lHr As Integer, _
                                     ByVal ArchiveContexts() As Object, _
                                     ByVal varContext As Object) _
  Implements IWMSCacheProxyServerCallback.OnDownloadContentFinished

    Dim ci As ContentInfo
    Dim ArchiveContext As IWMSContext
    Dim CacheFile As String
 
    Try
        ' The plug-in's call to IWMSCacheProxyServer.DownloadContent
        ' succeeded.
        If lHr = 0 Then
            ' Retrieve the user-defined ContentInfo object from
            ' varContext parameter.
            ci = varContext

            If ArchiveContexts.Length > 0 Then
                ' The content is not a playlist.
                If (ci.ContentType And 2) = 0 Then
                    ArchiveContext.GetStringValue(WMSDefines.WMS_ARCHIVE_FILENAME, _
                                                  WMSDefines.WMS_ARCHIVE_FILENAME_ID, _
                                                  CacheFile, _
                                                  0)
                    ci.CacheUrl = CacheFile
                Else
                    ' Save the playlist. SavePlaylist() is a 
                    ' user-defined function.
                    SavePlaylist(ci)
                End If
                ' Update the information for cached content.
                ' The UpdateTable() function is user-defined.
                UpdateTable(ci)
            End If
            ' Call OnAddCacheItem() to inform the server
            ' that content was successfully downloaded.
            ci.CacheProxyCallback.OnAddCacheItem(lHr, Nothing, varContext)

        End If

    Catch
        Throw New COMException()
    End Try

End Sub

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Concepts

IWMSCacheProxyServerCallback Object (Visual Basic .NET)