Windows media player visual studio

AxWindowsMediaPlayer Object (VB and C#)

The AxWindowsMediaPlayer object is the root object for the Windows Media Player control. It supports the properties, methods, and events listed in the following tables.

The AxWindowsMediaPlayer object supports the following properties.

Property Description
cdromCollection Gets an IWMPCdromCollection interface.
closedCaption Gets an IWMPClosedCaption interface.
Ctlcontrols Gets an IWMPControls interface.
Ctlenabled Gets or sets a value indicating whether the Windows Media Player control is enabled.
currentMedia Gets or sets the IWMPMedia interface that corresponds to the current media item.
currentPlaylist Gets or sets the current IWMPPlaylist interface.
dvd Gets an IWMPDVD interface.
enableContextMenu Gets or sets a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.
Error Gets an IWMPError interface.
fullScreen Gets or sets a value indicating whether video content is played back in full-screen mode.
isOnline Gets a value indicating whether the user is connected to a network.
isRemote Not supported for .NET programming.
mediaCollection Gets an IWMPMediaCollection interface.
network Gets an IWMPNetwork interface.
openState Gets a value indicating the state of the content source.
playerApplication Not supported for .NET programming.
playlistCollection Gets an IWMPPlaylistCollection interface.
playState Gets a value indicating the state of the Windows Media Player operation.
settings Gets an IWMPSettings interface.
status Gets a value indicating the current status of Windows Media Player.
stretchToFit Gets or sets a value indicating whether video will stretch to fit size of the Windows Media Player control video display.
uiMode Gets or sets a value indicating which controls are shown in the user interface when Windows Media Player is embedded in a webpage.
URL Gets or sets the name of the clip to play.
versionInfo Gets a value that specifies the version of the Windows Media Player.
windowlessVideo Gets or sets a value indicating whether the Windows Media Player control renders video in windowless mode.

The AxWindowsMediaPlayer object supports the following methods.

Method Description
close Releases Windows Media Player resources.
launchURL Sends a URL to the user’s default browser to be rendered.
newMedia Returns an IWMPMedia interface for a new media item.
newPlaylist returns an IWMPPlaylist interface for a new playlist.
openPlayer Opens Windows Media Player using the specified URL.

The AxWindowsMediaPlayer object supports the following events.

Embedding the Windows Media Player Control in a Visual Basic .NET Solution

To use the functionality of Windows Media Player 9 Series or later in a Visual Basic .NET application, first add the component to a form as described in Using the Windows Media Player Control with Microsoft Visual Studio

This section describes how to create an application that plays video and has custom play and stop buttons.

Add the Video Window

Add the Windows Media Player control to a form. Resize the control, and then place it where you want the video window to appear.

Select the Windows Media Player control, then change the uiMode property to «none». This setting hides the UI controls. When the user plays a video, it will appear in the window. For audio-only content, a visualization will appear.

Add Two Buttons and Adjust the Form

Now add two buttons to the form. Select the first button and change the Text property to «Play». Select the second button and change its Text property to «Stop».

Add the Play Code

Double-click the Play button to reveal the Code window. The following code is displayed:

Add this line to the subroutine:

In the preceding code example, «axWindowsMediaPlayer1» is the default name of the Windows Media Player control and «c:\mediafile.wmv» is a placeholder for the name of the media you want to play.

If you have added the digital media content from the Windows Media Player SDK to the library in Windows Media Player, you can use this code instead:

Because the autoStart property is true by default, Windows Media Player will start playing when you set the currentPlaylist or URL property.

Add the Stop Code

Double-click the Stop button to reveal the Code window. The following code is displayed:

Add this line to the subroutine:

The managed-code wrapper for the Windows Media Player control exposes the Controls object as Ctlcontrols to avoid collision with the Controls property inherited from System.Windows.Forms.Control.

Add Error-handling

The Windows Media Player control does not raise an exception when it encounters an error such as an invalid URL. Instead, the control signals an event. Your application should handle error events sent by the Player.

To create an event handler, open the code window for your form class. From the drop-down list at the top of the window, select the Windows Media Player control. A list of events appears in the drop-down list to the right. From that list, select MediaError. The following code is displayed:

The following code could be inserted in the subroutine to provide minimal error-handling capability. Note that information about the error can be retrieved from the _WMPOCXEvents_MediaErrorEvent argument.

Embedding the Windows Media Player Control in a C# Solution

To use the functionality of Windows Media Player in a C# application, first add the component to a form as described in Using the Windows Media Player Control with Microsoft Visual Studio

The following sections describe how to create an application that plays video and uses custom play and stop buttons.

Add the Video Window

Add the Windows Media Player ActiveX control to a form. Resize the control, and then place it where you want the video window to appear.

Select the Windows Media Player control, then change the uiMode property to «none». This setting hides the UI controls. When the user plays a video, it will appear in the window. For audio-only content, a visualization will appear.

Add Two Buttons and Adjust the Form

Now, add two buttons to the form. Select the first button and change the Text property to «Play». Select the second button and change its Text property to «Stop».

Add the Play Code

Double-click the Play button to reveal the Code window. In C#, the following code will be displayed:

Add this line between the two curly braces:

In the preceding code example, «axWindowsMediaPlayer1» is the default name of the Windows Media Player control, and «c:\mediafile.wmv» is a placeholder for the name of the media item you want to play. Any valid file path can be used. The @ symbol instructs the compiler to not interpret backslashes as escape characters.

If you have added the digital media content from the Windows Media Player SDK to the library in Windows Media Player, you can use this code instead:

Because the autoStart property is true by default, Windows Media Player will start playing when you set the currentPlaylist or URL property.

Add the Stop Code

Double-click the Stop button to reveal the Code window. In C#, the following code will be displayed:

Add this line between the two curly braces:

The managed-code wrapper for the Windows Media Player control exposes the Controls object as Ctlcontrols to avoid collision with the Controls property inherited from System.Windows.Forms.Control.

Add Error-handling

The Windows Media Player control does not raise an exception when it encounters an error such as an invalid URL. Instead, it signals an event. Your application should handle error events sent by the Player.

To create an event handler, first open the Properties window for the Windows Media Player control. In the list of events, double-click MediaError. The following code is displayed:

The following code could be inserted in the method to provide minimal error-handling capability. Note that information about the error can be retrieved from the _WMPOCXEvents_MediaErrorEvent argument.

Visual Studio Media Player

VorTechS

Inspired by the many videos of .NETs Webforms guru Jeff Fritz the Visual Studio Media Player Extension is, at this time, an integrated Audio Player (yes, right now the ‘Media’ part of the name is mis-leading but is something that we aim to change over the course of the development of this extension).

Based on the awesome BASS library by Ian Luck (http://un4seen.com), it can play all major audio files and online streams too (through PLS and M3U support).

Visualization support is provided through the BASSVIS plugin, and in version 1.0 is limited to the WinAMP AVS Studio.

The ‘best’ AVS Studio modules are included which support Windows 7 and above without crashing. (It’s taken many years to find the ones that cause AVS to crash on later version of Windows!).

The eagle eyed amongst you will notice that ‘Toumas: AVS Gone Bad’ has been removed due to the explicit nature of the text content. Modules can be installed by simply copying them into the Extension’s ‘plugins\avs’ folder. Access to the WinAMP Visual Studio has NOT been restricted, so you can even create new modules, or edit existing ones!

The extension is a ‘Single Use’ extension, meaning that the tool window will only activate in ONE instance of Visual Studio (who in their right mind would want multiple players running at the same time?). Configuration is held outside of Visual Studio Settings and therefore SHARED (stored in your APPDATA folder) between Visual Studio versions. After the running instance is closed (Visual Studio instance is closed), when re-opened playback will resume from where it left off.

It’s not perfect! There are, and will be issues, but please report issues and make requests using GitHub, here:

v1.8 Changes

Added ‘Quick Access’ toolbar with configuration option defaulted to ‘On’ (Note: no ability to control visibility yet!)

Added ‘Add Folder’ button to allow ability to quickly add folder media paths

Added ‘Play CD’ button for each CD/DVD device to allow ability of playback via CD (enabled when CD-audio detected)

Fixed ‘Stop playback on close’ doesn’t resume playback when adding a new media path

Fixed ‘Track Title’ not consuming entire space on right of ‘Play’ button

Fixed Unhandled exception when audio file contains invalid tag information during album-art image retrieval

v1.7 Changes

Added ‘Stop playback on close’ option, to stop media playback when the Media Player toolwindow closes

Fixed ‘Visual Studio’ layout change not disposing visualization layer when closing player control

Fixed bug ‘Visual Studio Media Player may fail to appear after closing and re-opening’

Changed ‘locking’ process so that closing the toolwindow clears the locking file (when Stop playback on close is enabled)

v1.6 Changes

Removed plugin.ini from the VSIX, this is not meant to be included with Visualizations

Added ability for VSIX to try and create the plugins folder to allow you to persist AVS settings (requires VS is run as Admin)

Added BASSFlag.BASS_MIXER_BUFFER when adding track to a BASS mixer

Added ‘Playlist Identification Method’ setting so playlists built on either Lowest Folder Name, Lowest Folder Parent Name, or Album Tag

Added localization support

Fixed Live Streams shouldn’t show a track length

Fixed Player throws wrong state change reasons when a playlist naturally ends

Fixed, for definite, Visualizations stop reacting to the music when a playlist naturally ends

Fixed player ALWAYS starts with Visualizations even if setting is switched off

v1.5 Changes

  • Visual Studio stopped including an important file in the VSIX output, manualy added NewtonSoft JSON to fix this
  • Fixed Visualizations are slow to start
  • Fixed media scanner not starting playback after initial configuration

v1.4 Changes

  • Re-build after preparing a new solution file (for the potential to make the project open source), was missing NewtonSoft JSON causing startup issues (again! )

v1.3 Changes

Fixed media scanner not picking up all supported files

Fixed media player not playing PLS or ASX live stream files

Playlists are now sorted alphabetically for easier access

Как работать с Windows media player?

Как добавить на форму проигрыватель Windows Media Player
Visual Basic 2010: Как добавить на форму проигрыватель Windows Media Player тот который идет в.

Как в ToolBox добавить «Windows Media Player»
Приветствую, Форумчане! Имеется какая-то возьможность в панель Toolbox добавить ‘Windows Medio.

Управление Windows Media Player из своего приложения
Всем желаю доброго здравия! Возникла потребность в управлении WinMediaPlayer’ом из своего.

Добавить компонент Windows Media Player на форму
У меня Visual Basic 2010 express. Нужно добавить компонент Windows Media Player на форму. Что я.

Решение

Да автор какой-то вздор пишет, по ходу.
Вот http://msdn.microsoft.com/ru-r. s.85).aspx
И на MSDN описан AxWindowsMediaPlayer, у которого таких методов нет.

Добавлено через 3 минуты
Ну есть где-то упоминания о каком-то Interop.WMPLib.dll (именно Interop, а не AxInterop), но раз даже в MSDN описана Ax-версия, то ее и надо использовать.

Вложения

WindowsApplication3.rar (208.0 Кб, 64 просмотров)

Заказываю контрольные, курсовые, дипломные и любые другие студенческие работы здесь или здесь.

Как установить Windows Media Player 7 на Windows XP SP3
Как установить WMP 7 на Windows XP SP3 Короче мне нравиться 7 проигрыватель и хочу его.

Как удалить Windows Media Player 11
Ситуация такая: Поставил себе Висту, там плеер был, палёный какой то, во время звучания музыки.

Как можно записать свой голос, сделать аудиофаил на Windows 2000 в Windows Media Player
Привет. Подскажите пожалуйста, как можно записать свой голос, сделать аудиофаил на Win2000.

windows media player как управлять ползунком
Подскажите как контролировать и управлять программно ползунком проигрывания видео файла. .

Читайте также:  Null modem emulator windows
Оцените статью