IWMPNetwork::bufferingCount 属性

[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 如果可能,Microsoft 强烈建议新代码使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]

bufferingCount 属性获取播放期间发生缓冲的次数。

语法

public System.Int32 bufferingCount {get; set;}

Public ReadOnly Property bufferingCount As System.Int32

属性值

作为缓冲计数的 System.Int32

备注

每次停止并重启播放时,此属性将重置为零。 如果播放暂停,则不会重置。

缓冲仅适用于流式处理内容。 此属性仅在使用 AxWindowsMediaPlayer.URL 属性设置播放 URL 时在运行时获取有效信息。

示例

以下示例使用 bufferingCount 显示播放期间发生缓冲的次数。 为了响应缓冲事件,该信息显示在标签中。 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)
{
    // Display the bufferingCount when buffering has started.
    if (e.start == true)
    {
        bufferingCountLabel.Text = ("Buffering count: " + player.network.bufferingCount);
    }  
}

' 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

    ' Display the bufferingCount when buffering has started.
    If (e.start = True) Then

        bufferingCountLabel.Text = ("Buffering count: " + player.network.bufferingCount)

    End If

End Sub

要求

要求
版本
Windows 媒体播放器 9 系列或更高版本
命名空间
WMPLib
程序集
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

另请参阅

AxWindowsMediaPlayer.URL (VB 和 C#)

IWMPNetwork 接口 (VB 和 C#)