Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, February 6, 2010 3:03 PM
Hi, I'm making my own media player using the WMP plugin and can't work out how to tell "AxWindowsMediaPlayer" to pause. If possible I would appreciate it if I could know how to fast forward as well.
Here's my media player so far...
All replies (13)
Saturday, February 6, 2010 3:10 PM ✅Answered | 1 vote
AxWindowsMediaPlayer1.Ctlcontrols.pause()
This code will pause the player.
For a fast forward system, you might want to use a track-bar or something so you can drag the line to adjust where the music / video is.
Unfortunately I don't know how to do this.
Hopefully someone else can help. :-)
Hope this helps,
DJ PIP
Saturday, February 6, 2010 3:25 PM ✅Answered | 1 vote
Maybe this will help
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
TrackBar1.Maximum = player.currentMedia.duration
TrackBar1.Value = player.Ctlcontrols.currentPosition
tracklabel.Text = TrackBar1.Value
player.settings.volume = TrackBar2.Value
End Sub
Private Sub TrackBar1_MouseUp _
(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TrackBar1.MouseUp
player.Ctlcontrols.currentPosition = TrackBar1.Value
Timer6.Enabled = True
End Sub
Private Sub TrackBar1_MouseDown _
(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TrackBar1.MouseDown
Timer6.Enabled = False
End Sub
Private Sub TrackBar1_MouseLeave _
(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.MouseLeave
Timer6.Enabled = True
End Sub
Private Sub player_MediaChange _
(ByVal sender As System.Object, ByVal e As AxWMPLib._WMPOCXEvents_MediaChangeEvent) Handles player.MediaChange
Label73.Text = player.currentMedia.name
End Sub
Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Saturday, February 6, 2010 3:20 PM
I did use that at first but I want to have full control on how it looks. :(
Thanks for the pause code though!
Saturday, February 6, 2010 3:27 PM | 1 vote
In that code I use player for the name of the control instead of AxWindowsMediaPlayer1Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Saturday, February 6, 2010 3:54 PM
Thanks for all your help and quick responses, it's really appreciated!
Saturday, February 6, 2010 4:14 PM
Thank-you for the code, it all works fine!
Sunday, May 23, 2010 3:25 PM
Private Sub Timer6_Tick( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
TrackBar1.Maximum = player.currentMedia.duration
When i use this Code i get an error on the first part (trackbar1.maximum = player.currentMedia.Duration)
(AxWindowsMediaPlayer changed to Player) Trackbar1 is the trackbar2 (on my form)
After debug i select an mp3 file ... click on play and the first line is highlighted.... when i remove it... the trackbar work same for the lable it display the time... But till the Maximum i set from the propreties.
what can be the solution?
****Edit****
what should be the Maximum of the Trackbar (in the propreties) ????
Monday, May 24, 2010 12:51 AM
You won't get an error if a song is playing or at least loaded so start the timer after a song is loaded . Show your code if you need more help . Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Monday, May 24, 2010 3:36 PM
You won't get an error if a song is playing or at least loaded so start the timer after a song is loaded . Show your code if you need more help . Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with thebutton . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Well i don't know i moved the Trackbar to the bottom of the application and made some tests on it. So i found out that when I mouse Over the TrackBar i get the error... If i do not mouse over the Trackbar and try to play everything work.
Maybe there is a way to make the Trackbar1.enabled= false and when the Player start the song it will become True ???
Also i can't get the next song to play from the listbox. I use for the Next Song button this code:
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If (PlayList.SelectedIndex + 1) <> PlayList.Items.Count Then
player.URL = PlayList.Items(PlayList.SelectedIndex + 1)
Else
End If
End Sub
" Play list is the name of the ListBox"
" player the name of the AxWindowsMediaPlayer1"
Monday, May 24, 2010 3:49 PM
In my Code it move to the next song in the listbox.... but for example if there is 5 songs in the listbox and i start with #1 in the listbox and click the next button .... it move to the song #2 but if i click it again i can't move it to the song # 3 or #4
Tuesday, May 25, 2010 4:45 AM
You should be using a playlist instead of setting the url of the song to be played you almost seem to be but are using the wrong code. Here is a project worth looking at
Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Tuesday, May 25, 2010 5:09 AM
You won't get an error if a song is playing or at least loaded so start the timer after a song is loaded . Show your code if you need more help . Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with thebutton . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Well i don't know i moved the Trackbar to the bottom of the application and made some tests on it. So i found out that when I mouse Over the TrackBar i get the error... If i do not mouse over the Trackbar and try to play everything work.
Maybe there is a way to make the Trackbar1.enabled= false and when the Player start the song it will become True ???
Also i can't get the next song to play from the listbox. I use for the Next Song button this code:
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click If (PlayList.SelectedIndex + 1) <> PlayList.Items.Count Then player.URL = PlayList.Items(PlayList.SelectedIndex + 1) Else End If End Sub" Play list is the name of the ListBox"
" player the name of the AxWindowsMediaPlayer1"
Here is some code to look at as well the first one uses an integer that represents an item in a playlist an actual playlist not a listbox . The Playlist is
Dim Playlist As IWMPPlaylist
AxWindowsMediaPlayer1.Ctlcontrols.playItem(Playlist.Item(ListBox2.SelectedIndex))
AxWindowsMediaPlayer1.Ctlcontrols.next()
AxWindowsMediaPlayer1.Ctlcontrols.previous()
Download the project I posted , unzip it and try it . Use the create playlist button .
Coding4fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
Please format the code in your posts with the button . Makes it easier to read . Or use the Forum Code Formatter by JohnWein http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/bf977a14-d9d4-4e84-9784-bf76b9e23261
Tuesday, May 25, 2010 7:38 AM
Thanks i will look into the Project..... Thanks for the Help.