Attribute/Method Name: Description:[Basic properties]
url:string; Specify media location, native or network address
uimode:string; Player interface mode, available for full, Mini, None, Invisible
Playstate:integer; Playback status, 1 = stop, 2 = pause, 3= play, 6 = buffering, 9 = connecting, 10 = Ready
Enablecontextmenu:boolean; Enable/Disable right-click menu
Fullscreen:boolean; Whether to display full screen
Basic Player Control
Ctlcontrols.play; Play
Ctlcontrols.pause; Time out
Ctlcontrols.stop; Stop it
Ctlcontrols.currentPosition:double; Current progress
Ctlcontrols.currentPositionString:string; Current progress, string format. such as "00:23"
Ctlcontrols.fastforward; Fast Forward
Ctlcontrols.fastreverse; Go back
Ctlcontrols.next; Next song
ctlcontrols.previous; Previous song
[Settings] Wmp.settings//Player basic settings
Settings.volume:integer; Volume, 0-100
Settings.autoStart:Boolean; Whether to play automatically
Settings.mute:Boolean; is muted
Settings.playCount:integer; Number of plays
[Currentmedia] Wmp.currentmedia//Current Media properties
currentMedia.duration:double; Total media length
currentMedia.durationString:string; Media total length, string format. such as "03:24"
Currentmedia.getiteminfo (const string); Get current media information "title" = Media title, "Author" = artist, "copyright" = Copyright Information, "Description" = Media content description, "Duration" = Duration (seconds), "FileSize" = File size, " FileType "= File type," sourceURL "= Original address
Currentmedia.setiteminfo (const string); Setting media information by property name
currentMedia.name:string; With Currentmedia.getiteminfo ("Title")
[Currentplaylist] Wmp.currentplaylist//Current Playlist properties
CurrentPlaylist.count:integer; The current playlist contains the number of media
Currentplaylist.item[integer]; Gets or sets the specified project media information whose sub-properties are the same as Wmp.currentmedia
AxWindowsMediaPlayer1.currentMedia.sourceURL; Gets the path of the media file being played
AxWindowsMediaPlayer1.currentMedia.name; Gets the name of the media file being played
AxWindowsMediaPlayer1.Ctlcontrols.Play Playback
AxWindowsMediaPlayer1.Ctlcontrols.Stop stop
AxWindowsMediaPlayer1.Ctlcontrols.Pause Pause
AxWindowsMediaPlayer1.Ctlcontrols.PlayCount file playback times
AxWindowsMediaPlayer1.Ctlcontrols.AutoRewind whether the loop plays
AxWindowsMediaPlayer1.Ctlcontrols.Balance Channel
AxWindowsMediaPlayer1.Ctlcontrols.Volume Volume
AxWindowsMediaPlayer1.Ctlcontrols.Mute Mute
AxWindowsMediaPlayer1.Ctlcontrols.EnableContextMenu whether to allow the shortcut menu to pop up when the right mouse button is clicked on the control
AxWindowsMediaPlayer1.Ctlcontrols.AnimationAtStart whether to play the animation before playing
AxWindowsMediaPlayer1.Ctlcontrols.ShowControls whether the control toolbar is displayed
AxWindowsMediaPlayer1.Ctlcontrols.ShowAudioControls Whether the Sound control button is displayed
AxWindowsMediaPlayer1.Ctlcontrols.ShowDisplay whether to display information about a data file
AxWindowsMediaPlayer1.Ctlcontrols.ShowGotoBar whether to show Goto bar
AxWindowsMediaPlayer1.Ctlcontrols.ShowPositionControls whether the position adjustment button is displayed
AxWindowsMediaPlayer1.Ctlcontrols.ShowStatusBar whether the status bar is displayed
AxWindowsMediaPlayer1.Ctlcontrols.ShowTracker whether the progress bar is displayed
AxWindowsMediaPlayer1.Ctlcontrols.FastForward Fast Forward
AxWindowsMediaPlayer1.Ctlcontrols.FastReverse, come back.
AxWindowsMediaPlayer1.Ctlcontrols.Rate Fast forward/rewind rate
Axwindowsmediaplayer1.allowchangedisplaysize whether to allow free setting of the playback image size
Axwindowsmediaplayer1.displaysize setting the playback image size
1-mpdefaultsize Original Size
2-mphalfsize half of the original size
3-mpdoublesize twice times the original size
4-mpfullscreen fullscreen
5-mponesixteenthscreen 1/16 of screen size
6-mponefourthscreen 1/4 of screen size
7-mponehalfscreen 1/2 of screen size
Axwindowsmediaplayer1.clicktoplay allows you to click the Playback window to start Media Player
After the video is played, you can read the width and height of the source video in the following ways, and then set it to revert to its original size.
private void Resizeoriginal ()
{
int intwidth = AxWindowsMediaPlayer1.currentMedia.imageSourceWidth;
int intheight = AxWindowsMediaPlayer1.currentMedia.imageSourceHeight;
Axwindowsmediaplayer1.width = intwidth + 2;
Axwindowsmediaplayer1.height = intheight + 2;
}
To open a media file and play:
Dim FilePath as String
With Me.openfiledialog1
. Title = "Open Voice file"
. Checkpathexists = True
. Checkfileexists = True
. MultiSelect = False
. Filter = "MP3 file (*.mp3) |*.mp3| All Files (*. *) |*.*"
If. ShowDialog = DialogResult.Cancel Then
Exit Sub
End If
FilePath =. FileName
End with
Me.Text = "PC repeater-Files" & FilePath
Axwindowsmediaplayer1.url = FilePath
Try
Me.AxWindowsMediaPlayer1.Ctlcontrols.play ()
Catch ex as Exception
MsgBox ("Sorry, cannot play this format voice file", Msgboxstyle.okonly, "PC Repetition Machine")
Exit Sub
End Try
Attention:
The URL in Axwindowsmediaplayer1.url is the name of the file that you want to play, and the original Name property is canceled.
AxWindowsMediaPlayer1.Ctlcontrols.play () plays, as well as other properties such as Pause,stop.
The AxWindowsMediaPlayer1.settings.balance represents the channel settings for media playback, 0 for equalization, and 1 and 1 for the left and right channels.
AxWindowsMediaPlayer1.currentMedia.duration indicates the length of time to play the file. It can be used to get the file length.
AxWindowsMediaPlayer1.Ctlcontrols.currentPosition indicates the current playback position of the file being played, and this property can be used to forward and backward the media file settings.
Axwindowsmediaplayer1.ctlcontrols.currentposition+1 represents the forward 1 units of time.
AxWindowsMediaPlayer1.settings.rate playback rate, typically multiplied by 16 before displaying Kbps units.
Note: In the above program, if you add one to the following:
MsgBox (AxWindowsMediaPlayer1.currentMedia.duration.ToString)
The result is likely to be 0, so it is likely that this time it will not get the length of the file's playback and is prone to error. So you can add a Timer control when you use it:
Private Sub Timer1_Tick (ByVal sender as Object, ByVal e as System.EventArgs) Handles Timer1.tick
EndPoint = AxWindowsMediaPlayer1.currentMedia.duration
If EndPoint = 0 Then Exit Sub ' may take some time because the media file is open, waiting for the media file to open
MsgBox (AxWindowsMediaPlayer1.currentMedia.duration.ToString)
End Sub
The file playback length is displayed at MsgBox.
2. Ctlcontrols Properties
The Ctlcontrols property is an important property of AxWindowsMediaPlayer, and there are many common members in this control.
(1) Method play
Used to play a multimedia file in the following format:
The name of the form. The name of the control. Ctlcontrols.play ()
Example: AxWindowsMediaPlayer1.Ctlcontrols.play () ' Here the default form name is Me
(2) Method pause
Used to pause a multimedia file that is playing, in the form of:
The name of the form. The name of the control. Ctlcontrols.pause ()
such as: AxWindowsMediaPlayer1.Ctlcontrols.pause ()
(3) Method stop
Used to stop a multimedia file that is playing, in the form of:
The name of the form. The name of the control. Ctlcontrols.stop ()
such as: AxWindowsMediaPlayer1.Ctlcontrols.stop ()
(4) Method Fastforward
Used to fast forward the multimedia file being played, in the format:
The name of the form. The name of the control. Ctlcontrols.fastforward ()
such as: AxWindowsMediaPlayer1.Ctlcontrols.forward ()
(5) Method Fastreverse
The name of the form. The name of the control. Ctlcontrols.fastreverse ()
such as: AxWindowsMediaPlayer1.Ctlcontrols.fastreverse ()
6. Attribute CurrentPosition
Used to get the current playback progress of a multimedia file whose value is a numeric type, using the format:
The name of the form. The name of the control. Ctlcontrols.currentposition
D1 =axwindowsmediaplayer1.ctlcontrols.currentposition
Where d1 is an integer variable.
7. Attribute Duration
Used to get the total time of playback for the current multimedia file, whose value is a numeric type, using the format:
The name of the form. The name of the control. Currentmedia.duration
such as: D2 =axwindowsmediaplayer1.currentmedia.duration
Where D2 is an integer variable.
Activex WindowsMediaPlayer Control Main Method Properties