访问Windows Media Player的播放速度控件

时间:2021-02-25 15:53:15

Is there a way to access WMP10+'s playback speed controls in a dotnet app?

有没有办法在dotnet应用程序中访问WMP10 +的播放速度控件?

User level information on the Playback control information

有关播放控制信息的用户级别信息

2 个解决方案

#1


If you are using a MediaElement object, I would suggest adjusting the SpeedRatio property. Here is an example from Microsoft.

如果您使用的是MediaElement对象,我建议您调整SpeedRatio属性。以下是Microsoft的一个示例。

From your comment, it sounds like the SpeedRatio is the way to go. Because it allows you to adjust the playback speed. The MediaElement or MediaPlayer is basically just a Windows Media Player.

从您的评论中,听起来像SpeedRatio是要走的路。因为它允许您调整播放速度。 MediaElement或MediaPlayer基本上只是一个Windows Media Player。

#2


Add the AxWMPLib to your VB/C# project. Add an AxWindowsMediaPlayer control to your form.

将AxWMPLib添加到VB / C#项目中。将AxWindowsMediaPlayer控件添加到表单中。

Use the following method to access playback rate:

使用以下方法访问播放速率:

AxWindowsMediaPlayer1.URL = "e:\song.mp3"
AxWindowsMediaPlayer1.Ctlcontrols.play()
AxWindowsMediaPlayer1.settings.rate = 0.5

*Note that rate may not always be available depending on the media type. A safer method of accessing rate would look like:

*请注意,根据媒体类型,可能无法始终使用速率。更安全的访问速率方法如下:

If (player.settings.isAvailable("Rate")) Then
    player.settings.rate = 0.5
End If

If that isn't what you're looking for, there also exists the MediaPlayer COM object. I didn't investigate it thoroughly, but intellisense yielded:

如果那不是你想要的,那么也存在MediaPlayer COM对象。我没有彻底调查,但intellisense产生了:

Dim mpMediaPlayer As New MediaPlayer.MediaPlayer
mpMediaPlayer.FileName = "e:\song.mp3"
mpMediaPlayer.Rate = 0.5
mpMediaPlayer.Play()

Hope that helps.

希望有所帮助。

#1


If you are using a MediaElement object, I would suggest adjusting the SpeedRatio property. Here is an example from Microsoft.

如果您使用的是MediaElement对象,我建议您调整SpeedRatio属性。以下是Microsoft的一个示例。

From your comment, it sounds like the SpeedRatio is the way to go. Because it allows you to adjust the playback speed. The MediaElement or MediaPlayer is basically just a Windows Media Player.

从您的评论中,听起来像SpeedRatio是要走的路。因为它允许您调整播放速度。 MediaElement或MediaPlayer基本上只是一个Windows Media Player。

#2


Add the AxWMPLib to your VB/C# project. Add an AxWindowsMediaPlayer control to your form.

将AxWMPLib添加到VB / C#项目中。将AxWindowsMediaPlayer控件添加到表单中。

Use the following method to access playback rate:

使用以下方法访问播放速率:

AxWindowsMediaPlayer1.URL = "e:\song.mp3"
AxWindowsMediaPlayer1.Ctlcontrols.play()
AxWindowsMediaPlayer1.settings.rate = 0.5

*Note that rate may not always be available depending on the media type. A safer method of accessing rate would look like:

*请注意,根据媒体类型,可能无法始终使用速率。更安全的访问速率方法如下:

If (player.settings.isAvailable("Rate")) Then
    player.settings.rate = 0.5
End If

If that isn't what you're looking for, there also exists the MediaPlayer COM object. I didn't investigate it thoroughly, but intellisense yielded:

如果那不是你想要的,那么也存在MediaPlayer COM对象。我没有彻底调查,但intellisense产生了:

Dim mpMediaPlayer As New MediaPlayer.MediaPlayer
mpMediaPlayer.FileName = "e:\song.mp3"
mpMediaPlayer.Rate = 0.5
mpMediaPlayer.Play()

Hope that helps.

希望有所帮助。