IWMPNetwork::sourceProtocol 属性
[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 Microsoft 强烈建议新代码尽可能使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]
sourceProtocol 属性获取用于接收数据的源协议。
语法
public System.String sourceProtocol {get; set;}
Public ReadOnly Property sourceProtocol As System.String
属性值
作为源协议的名称的 System.String 。
备注
此属性在播放 CD 或 DVD 时获取零长度字符串 (“”) 。
示例
下面的代码示例使用 sourceProtocol 显示用于接收数据的源协议。 该信息显示在标签中,以响应 PlayStateChange 事件。 AxWMPLib.AxWindowsMediaPlayer 对象由名为 player 的变量表示。
// Add a delegate for the PlayStateChange event.
player.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(player_PlayStateChange);
// Create an event handler for the PlayStateChange event.
private void player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
// Display the network source protocol when the player is playing by testing for a
// play state enum value of WMPLib.WMPPlayState.wmppsPlaying which equals 3.
if (e.newState == 3)
{
sourceProtocolLabel.Text = ("Source protocol: " + player.network.sourceProtocol);
}
}
' Create an event handler for the PlayStateChange event.
Public Sub player_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles player.PlayStateChange
' Display the network source protocol when the player is playing by testing for a
' play state enum value of WMPLib.WMPPlayState.wmppsPlaying which equals 3.
If (e.newState = 3) Then
sourceProtocolLabel.Text = ("Source protocol: " + player.network.sourceProtocol)
End If
End Sub
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器 9 系列或更高版本 |
命名空间 |
WMPLib |
程序集 |
|
另请参阅
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈