IWMPNetwork::d ownloadProgress 속성

[이 페이지와 연결된 기능인 Windows 미디어 플레이어 SDK는 레거시 기능입니다. MediaPlayer로 대체되었습니다. MediaPlayer는 Windows 10 및 Windows 11 최적화되었습니다. 가능한 경우 새 코드에서 Windows 미디어 플레이어 SDK 대신 MediaPlayer를 사용하는 것이 좋습니다. 가능한 경우 레거시 API를 사용하는 기존 코드를 다시 작성하여 새 API를 사용하도록 제안합니다.]

downloadProgress 속성은 완료된 다운로드 비율을 가져옵니다.

구문

public System.Int32 downloadProgress {get; set;}

Public ReadOnly Property downloadProgress As System.Int32

속성 값

백분율로 표시되는 다운로드 진행률인 System.Int32 입니다.

설명

Windows 미디어 플레이어 컨트롤이 동시에 재생 및 다운로드할 수 있는 디지털 미디어 파일에 연결되면 downloadProgress 속성은 다운로드된 총 파일의 백분율을 가져옵니다. 이 기능은 현재 웹 서버에서 다운로드한 디지털 미디어 파일에 대해서만 지원됩니다. 다음 형식의 파일을 다운로드하여 동시에 재생할 수 있습니다.

  • ASF(Advanced Systems Format)
  • WMA(Windows Media 오디오)
  • WMV(Windows Media Video)
  • MP3
  • Mpeg
  • WAV

또한 일부 AVI 파일을 다운로드하여 동시에 재생할 수 있습니다.

AxWindowsMediaPlayer._WMPOCXEvents_BufferingEvent 사용하여 버퍼링이 시작되거나 중지되는 시기를 결정합니다.

예제

다음 코드 예제에서는 downloadProgress 를 사용하여 완료된 다운로드 비율을 표시합니다. 정보는 버퍼링 이벤트에 대한 응답으로 레이블에 표시됩니다. 이 예제에서는 1초 간격의 타이머를 사용하여 디스플레이를 업데이트합니다. AxWMPLib.AxWindowsMediaPlayer 개체는 player라는 변수로 표시됩니다.

// Add a delegate for the Buffering event.
player.Buffering += new AxWMPLib._WMPOCXEvents_BufferingEventHandler(player_Buffering);

// Create an event handler for the Buffering event.
private void player_Buffering(object sender, AxWMPLib._WMPOCXEvents_BufferingEvent e)
{
    // Determine whether buffering has started or stopped.
    if (e.start == true)
    {
        // Set the timer interval at one second (1000 miliseconds).
        timer.Interval = 1000;
        
        // Start the timer.
        timer.Start();
    }
    else
    {
        // Buffering is complete. Stop the timer.
        timer.Stop();
    }
}

// Update the download progress in a timer event handler.
private void UpdateDownloadProgress(object sender, EventArgs e)
{
    downloadProgressLabel.Text = ("Download progress: " + player.network.downloadProgress + " percent complete");
}

' Create an event handler for the Buffering event.
Public Sub player_Buffering(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_BufferingEvent) Handles player.Buffering

    ' Test whether packets may be arriving.
    Select Case e.newState

    ' If WMPPlayState is Stopped, Paused, ScanForward, ScanReverse, Waiting, MediaEnded
    ' or Transitioning then stop the timer. 
        Case 1
        Case 2
        Case 4
        Case 5
        Case 7
        Case 8
        Case 9
            timer.Stop()

        ' If WMPPlayState is Playing or Buffering then set the timer interval and start the timer.
        Case Else
            timer.Interval = 1000
            timer.Start()

    End Select

End Sub

' Update the download progress in a timer event handler.
Public Sub UpdateDownloadProgress(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick

    downloadProgressLabel.Text = ("Download progress: " + player.network.downloadProgress + " percent complete")

End Sub

요구 사항

요구 사항
버전
Windows 미디어 플레이어 9 시리즈 이상
네임스페이스
WMPLib
어셈블리
Interop.WMPLib.dll(Interop.WMPLib.dll.dll)

추가 정보

AxWindowsMediaPlayer.Buffering 이벤트(VB 및 C#)

IWMPNetwork 인터페이스(VB 및 C#)