Axwindowsmediaplayer media file main method attributes)

Source: Internet
Author: User

Main method attributes of axwindowsmediaplayer media files

Attribute/method name: Description:
[Basic attributes]
URL: string; specifies the media location, local or network address
Uimode: string; player interface mode, which can be full, Mini, none, invisible
Playstate: integer; playback status, 1 = stopped, 2 = paused, 3 = played, 6 = buffering, 9 = connected, 10 = ready
Enablecontextmenu: Boolean; enable/disable context menu
Fullscreen: Boolean; Whether to display in full screen
// Basic player control
Ctlcontrols. Play; play
Ctlcontrols. Pause; pause
Ctlcontrols. Stop; stop
Ctlcontrols. currentposition: Double; current progress
Ctlcontrols. currentpositionstring: string; current progress, string format. For example"
Ctlcontrols. fastforward; Fast Forward
Ctlcontrols. fastreverse; fast return
Ctlcontrols. Next; next
Ctlcontrols. Previous; previous line
[Settings] WMP. settings // basic player settings
Settings. Volume: integer; volume: 0-100
Settings. autostart: Boolean; Whether to play automatically
Settings. Mute: Boolean; mute
Settings. playcount: integer; number of playbacks
[Currentmedia] WMP. currentmedia // current media attribute
Currentmedia. Duration: Double; total media Length
Currentmedia. durationstring: string; total media length, in string format. For example"
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); set media information by attribute name
Currentmedia. Name: string; same as currentmedia. getiteminfo ("title ")
[Currentplaylist] WMP. currentplaylist // attributes of the current playlist
Currentplaylist. Count: integer; number of media contained in the current playlist
Currentplaylist. item [integer]; gets or sets the media information of the specified project. Its subattributes are the same as that of WMP. currentmedia.
Axwindowsmediaplayer1.currentmedia. sourceurl; // obtain the path of the media file being played.
Axwindowsmediaplayer1.currentmedia. Name; // gets the name of the media file being played.
Axwindowsmediaplayer1.ctlcontrols. Play Play
Axwindowsmediaplayer1.ctlcontrols. Stop Stop
Axwindowsmediaplayer1.ctlcontrols. Pause Pause
Axwindowsmediaplayer1.ctlcontrols. playcount File playback times
Axwindowsmediaplayer1.ctlcontrols. autorewind Loop playback?
Axwindowsmediaplayer1.ctlcontrols. Balance Audio channel
Axwindowsmediaplayer1.ctlcontrols. Volume Volume
Axwindowsmediaplayer1.ctlcontrols. Mute Mute
Axwindowsmediaplayer1.ctlcontrols. enablecontextmenu Allow shortcut menu to pop up when right-clicking the control
Axwindowsmediaplayer1.ctlcontrols. animationatstart Whether to play the animation before playback
Axwindowsmediaplayer1.ctlcontrols. showcontrols Display Control Toolbar
Axwindowsmediaplayer1.ctlcontrols. showaudiocontrols Whether to display the sound control button
Axwindowsmediaplayer1.ctlcontrols. showdisplay Whether to display information about the data file
Axwindowsmediaplayer1.ctlcontrols. showgotobar Show? Goto Column
Axwindowsmediaplayer1.ctlcontrols. showpositioncontrols Whether to display the position adjustment button
Axwindowsmediaplayer1.ctlcontrols. showstatusbar Display status bar?
Axwindowsmediaplayer1.ctlcontrols. showtracker Display progress bar?
Axwindowsmediaplayer1.ctlcontrols. fastforward Fast forward
Axwindowsmediaplayer1.ctlcontrols. fastreverse Quick Return
Axwindowsmediaplayer1.ctlcontrols. Rate Fast forward/Fast Return Rate
Axwindowsmediaplayer1.allowchangedisplaysize Whether the playback image size can be set freely
Axwindowsmediaplayer1.displaysize Set the playback image size
1-mpdefaultsize Original size
2-mphalfsize Half of the original size
3-mpdoublesize Twice the original size
4-mpfullscreen Full Screen
5-mponesixteenthscreen Screen Size 1/16
6-mponefourthscreen Screen Size 1/4
7-mponehalfscreen Screen Size 1/2
Axwindowsmediaplayer1.clicktoplay Whether to enable enabling by clicking the playback window Media Player

After the video is played , You can read the width and height of the source video as follows: , Then set it to restore to the original size. .
Private void resizeoriginal ()
{
Int intwidth = axwindowsmediaplayer1.currentmedia. imagesourcewidth;
Int intheight = axwindowsmediaplayer1.currentmedia. imagesourceheight;
Axwindowsmediaplayer1.width = intwidth + 2;
Axwindowsmediaplayer1.height = intheight + 2;
}

Open and play a media file:

Dim filepath as string
With me. openfiledialog1
. Title =" Open a 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
Me. Text = "PC Repeater - File"& Filepath
Axwindowsmediaplayer1.url = filepath
Try
Me. axwindowsmediaplayer1.ctlcontrols. Play ()
Catch ex as exception
Msgbox (" Sorry, you cannot play audio files in this format. ", Msgboxstyle. okonly," PC Repeater ")
Exit sub
End try

Note::

Axwindowsmediaplayer1.urlMediumURLIndicates the name of the file to be played.,Canceled the originalNameAttribute.

Axwindowsmediaplayer1.ctlcontrols. Play ()Play,There are alsoPause, stopOther attributes.

Axwindowsmediaplayer1.settings. BalanceSpecifies the audio channel settings for media playback., 0Balance,-1And1Indicates the left-right audio channel..

Axwindowsmediaplayer1.currentmedia. DurationThe duration of the file to be played..Use it to get the file length.

Axwindowsmediaplayer1.ctlcontrols. currentpositionIndicates the current playback position of the file being played.,This attribute can be used to set forward and backward for media files..For example

Axwindowsmediaplayer1.ctlcontrols. currentposition + 1Forward1Time Unit.

Axwindowsmediaplayer1.settings. RatePlayback rate,Multiply16And then displayKbpsUnit.

Note::AboveProgramMedium,If one of the following is added:

Msgbox (axwindowsmediaplayer1.currentmedia. Duration. tostring)

The result is probably0Therefore, the playback duration of the file may not be obtained at this time, which is prone to errors. Therefore, you can addTimerControls:

Private sub timereffectick (byval sender as object, byval e as system. eventargs) handles timer1.tick
Endpoint = axwindowsmediaplayer1.currentmedia. Duration
If endpoint = 0 Then exit sub'It may take some time to open a media file.

Msgbox (axwindowsmediaplayer1.currentmedia. Duration. tostring)

End sub

In this caseMsgboxThe playback length of the file is displayed.

2. ctlcontrolsAttribute

CtlcontrolsAttribute isAxwindowsmediaplayerAn important attribute, This control has many common members.

(1)MethodPlay

Used to play multimedia files. The format is:

Form name.Control name. Ctlcontrols. Play ()

For example:Axwindowsmediaplayer1.ctlcontrols. Play ()'The default form name isMe

(2)MethodPause

Used to pause a video. The format is as follows:

Form name.Control name. Ctlcontrols. Pause ()

For example:Axwindowsmediaplayer1.ctlcontrols. Pause ()

(3)MethodStop

The format of a multimedia file used to stop playing is as follows:

Form name.Control name. Ctlcontrols. Stop ()

For example:Axwindowsmediaplayer1.ctlcontrols. Stop ()

(4)MethodFastforward

This interface is used to fast forward a video. The format is as follows:

Form name.Control name. Ctlcontrols. fastforward ()

For example:Axwindowsmediaplayer1.ctlcontrols. Forward ()

(5)MethodFastreverse

Form name.Control name. Ctlcontrols. fastreverse ()

For example:Axwindowsmediaplayer1.ctlcontrols. fastreverse ()

6.AttributeCurrentposition

Used to obtain the current playback progress of a multimedia file. The value is of the numerical type and the format is as follows:

Form name.Control name. Ctlcontrols. currentposition

D1 = axwindowsmediaplayer1.ctlcontrols. currentposition

WhereD1Is an integer variable.

7.AttributeDuration

Used to obtain the total playback Time of the current multimedia file. The value is of the numerical type. The format is as follows:

Form name.Control name. Currentmedia. Duration

For example:D2 = axwindowsmediaplayer1.currentmedia. Duration

WhereD2Is an integer variable.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.