Results 1 to 11 of 11

Thread: [Resolved] mediaplayer1 repeat

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2007
    Posts
    110

    Resolved [Resolved] mediaplayer1 repeat

    This is my code, and i dont get repeat to work.
    I think i did something wrong with last code.


    vb Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click() ' Browse button (works perfectly)
    4.     Me.CommonDialog1.Filter = "MP3 Files (*.mp3)|*.mp3|WAV Files (*.wav)|*.wav|MPG Movies (*.mpg)|*.mpg|AVI Movies (*.avi)|*.avi"
    5.     Me.CommonDialog1.ShowOpen
    6.     If Me.CommonDialog1.FileName <> "" Then
    7.         Me.MediaPlayer1.FileName = Me.CommonDialog1.FileName
    8.         Me.MediaPlayer1.Play
    9.     Else
    10.         MsgBox "Select a file first."
    11.     End If
    12. End Sub
    13.  
    14. Private Sub Command2_Click() ' Hides the window
    15.     music.Hide
    16. End Sub
    17.  
    18.  
    19. Private Sub command3_click() ' Changes caption when click repeat box
    20.     If (Command3.Caption = "Repeat (off)") Then
    21.         Command3.Caption = "Repeat (on)"
    22.     ElseIf (Command3.Caption = "Repeat (on)") Then
    23.         Command3.Caption = "Repeat (off)"
    24.     End If
    25. End Sub
    26.  
    27. Private Sub mediaplayer1_done() ' Should repeat, but wont work :S
    28. If (Me.Command3.Caption = "Repeat (off)") Then
    29.     Me.MediaPlayer1.Stop
    30. ElseIf (Me.Command3.Caption = "Repeat (on)") Then
    31.     Me.MediaPlayer1.FileName = Me.CommonDialog1.FileName
    32.     Me.MediaPlayer1.Play
    33. End If
    34. End Sub

    Thanks,
    Marius
    Last edited by Mariuswb; Jul 30th, 2007 at 04:34 AM.

  2. #2
    Fanatic Member drivenbywhat's Avatar
    Join Date
    Jan 2007
    Location
    VA - USA
    Posts
    866

    Re: mediaplayer1 repeat

    If your button only says "repeat (on)" or "repeat (off)", then perhaps try getting rid of the ElseIf. In that line, just put ELSE and continue with code.
    [vb5 & starting to move to vb2008] I appreciate the help I get from everyone. Thank you.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2007
    Posts
    110

    Re: mediaplayer1 repeat

    Does not work

    Here is my project.
    Attached Files Attached Files

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: mediaplayer1 repeat

    You need to validate the repeat in MediaPlayer1_EndOfStream event

  5. #5
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: mediaplayer1 repeat

    This works

    Code:
    Private Sub MediaPlayer1_EndOfStream(ByVal Result As Long)
        Me.MediaPlayer1.Stop
        If (Me.Command3.Caption = "Repeat (off)") Then
            Me.MediaPlayer1.Stop
        Else
            Me.MediaPlayer1.FileName = Me.CommonDialog1.FileName
            Me.MediaPlayer1.Play
        End If
    
    End Sub

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2007
    Posts
    110

    Re: mediaplayer1 repeat

    thank you very much Fazi

  7. #7
    Fanatic Member drivenbywhat's Avatar
    Join Date
    Jan 2007
    Location
    VA - USA
    Posts
    866

    Re: mediaplayer1 repeat

    Yes, that worked. I was beginning to think he didn't have it in the right event but I couldn't get his project to work for me because we have different versions of MP installed. How can one get the old MP control on vb if you have the latest MP installed that replaces the old control?
    [vb5 & starting to move to vb2008] I appreciate the help I get from everyone. Thank you.

  8. #8
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [Resolved] mediaplayer1 repeat

    DrivenByWat, i also had the media player 10.
    so i downlod and registred the msdxm.ocx from http://www.ocxdump.com/ocxfiles/M/msdxm.ocx
    , to register this ocx, open your Run dialog, type Regsvr32 and leave a space, now drag and drop the downloded file in to your Run Dialog. so the path is auto completed. say ok. a message sould appear 'Registration of OCX Succesfull'.

    Thank you for your effort tooo to solve his issue.

  9. #9
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [Resolved] mediaplayer1 repeat

    This ocx does not overwrite your previous one

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jul 2007
    Posts
    110

    Re: [Resolved] mediaplayer1 repeat

    yes. thats what i used

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jul 2007
    Posts
    110

    Re: [Resolved] mediaplayer1 repeat

    Well. The question is answered now
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width