Lecteur mp3

Soyez le premier à donner votre avis sur cette source.

Vue 10 828 fois - Téléchargée 1 343 fois

Description

Un petit lecteur MP3 qui utilise uindoze media player... Vous pouvez downloader le zip si vous voulez pas recopier tout le source...

Source / Exemple :


Dim min As Integer
Dim sec As Integer
Dim sec2 As Integer
Dim minplay As Integer
Dim secplay As Integer
Dim sec2play As Integer
Dim Seul As Boolean
Dim Namechar
Dim Indexchar
Dim pause As Boolean

Private Sub About_Click()
Form2.Show
End Sub

Private Sub Command1_Click()
If pause = True Then
MediaPlayer1.Play
Else
    MediaPlayer1.FileName = List1.Text
        If MediaPlayer1.FileName = "" Then
        Exit Sub
        Else
           MediaPlayer1.Play
    Slider1.Max = MediaPlayer1.Duration
    Timer1.Enabled = True
    Timer2.Enabled = True
    End If
    pause = False
        End If
End Sub

Private Sub Command10_Click()
'MediaPlayer1.FileName = List1.Text
'MediaPlayer1.CurrentPosition = MediaPlayer1.Duration - 2
'Timer3.Enabled = True
'MediaPlayer1.Play
End Sub

Private Sub Command2_Click()
pause = True
    MediaPlayer1.pause
End Sub

Private Sub Command3_Click()
    MediaPlayer1.Stop
    MediaPlayer1.CurrentPosition = 0
End Sub

Private Sub Command4_Click()
On Error Resume Next
        If List1.Text = "" Then
        Exit Sub
        Else
        List1.ListIndex = List1.ListIndex - 1
        MediaPlayer1.FileName = List1.Text
            Slider1.Max = MediaPlayer1.Duration
            MediaPlayer1.Play
        End If
End Sub

Private Sub Command5_Click()
On Error Resume Next
        If List1.Text = "" Then
        Exit Sub
        Else
            List1.ListIndex = List1.ListIndex + 1
            MediaPlayer1.FileName = List1.Text
            Slider1.Max = MediaPlayer1.Duration
            MediaPlayer1.Play
        End If
End Sub

Private Sub Command6_Click()
On Error GoTo Erreur
    dlgop.Filter = "Tous les fichiers (*.*)|*.*|Fichiers Audio MPEG (*.MP3, *.MP2) | *.MP3; *.MP2 | Fichiers Audio (*.wav, *.wma, *.snd)|*.wav; *.wma; *.snd|Fichier MIDI (*.mid, *.rmi, *.midi)|*.mid; *.rmi; *.midi"
    dlgop.FilterIndex = 2
    dlgop.ShowOpen
        List1.AddItem (dlgop.FileName)
Erreur:
    Exit Sub
End Sub

Private Sub Command7_Click()
    If List1.Text <> "" Then
        List1.RemoveItem (List1.ListIndex)
    Else
    Exit Sub
    End If
End Sub

Private Sub Command8_Click()
    Namechar = List1.Text
    Indexchar = List1.ListIndex - 1
        If List1.Text <> "" Then
            If List1.ListIndex <> 0 Then
                List1.RemoveItem List1.ListIndex
                    List1.AddItem Namechar, Indexchar
                List1.Text = Namechar
            Else
                Exit Sub
            End If
        End If
End Sub

Private Sub Command9_Click()
    If List1.Text <> "" Then
        If List1.ListIndex <> List1.ListCount - 1 Then
            Namechar = List1.Text
                Indexchar = List1.ListIndex + 1
                    List1.RemoveItem List1.ListIndex
                List1.AddItem Namechar, Indexchar
            List1.Text = Namechar
        Else
            Exit Sub
        End If
    End If
End Sub

Private Sub Form_Load()
    Label2.Caption = "0:00 / 0:00"
End Sub

Private Sub List1_DblClick()
        If pause = True Then
    MediaPlayer1.Play
        Else
            MediaPlayer1.FileName = List1.Text
                If MediaPlayer1.FileName = "" Then
                    Exit Sub
                Else
                    Timer2.Enabled = True
                End If
    MediaPlayer1.Play
                    If MediaPlayer1.Duration < 1 Then
                        Slider1.Max = 1
                    Else
                        Slider1.Max = MediaPlayer1.Duration
                        Timer1.Enabled = True
                    End If
        End If
End Sub

Private Sub Quit_Click()
    Unload Me
    End
End Sub

Private Sub Slider1_Scroll()
    MediaPlayer1.CurrentPosition = Slider1.Value
End Sub

Private Sub Slider2_Scroll()
    MediaPlayer1.Volume = "-" & Slider2.Value
    Slider2.Text = ""
End Sub

Private Sub Timer1_Timer()
    Slider1.Value = MediaPlayer1.CurrentPosition
        If MediaPlayer1.CurrentPosition = MediaPlayer1.Duration Then
                If List1.ListIndex = List1.ListCount - 1 Then
                    MediaPlayer1.Stop
                    Exit Sub
                Else
                    List1.ListIndex = List1.ListIndex + 1
                    MediaPlayer1.FileName = List1.Text
                    Slider1.Max = MediaPlayer1.Duration
                    MediaPlayer1.Play
                End If
                   Else
                   Exit Sub
                   End If
End Sub

Private Sub Timer2_Timer()
             minplay = Int(MediaPlayer1.Duration / 60)
    secplay = Int(minplay * 60)
    sec2play = Int(MediaPlayer1.Duration - secplay)
        If sec2play < 10 Then
            Seul = False
        Else
            Seul = True
        End If
    min = Int(MediaPlayer1.CurrentPosition / 60)
    sec = Int(MediaPlayer1.CurrentPosition / 60) * 60
    sec2 = Int(MediaPlayer1.CurrentPosition - sec)
    If Seul = True Then
        If sec2 < 10 Then
            Label2.Caption = min & ":0" & sec2 & " / " & minplay & ":" & sec2play
        Else
            Label2.Caption = min & ":" & sec2 & " / " & minplay & ":" & sec2play
        End If
    Else
            If sec2 < 10 Then
    Label2.Caption = min & ":0" & sec2 & " / " & minplay & ":0" & sec2play
        Else
    Label2.Caption = min & ":" & sec2 & " / " & minplay & ":0" & sec2play
    End If
    End If
End Sub

Private Sub Timer3_Timer()
    MediaPlayer1.CurrentPosition = MediaPlayer1.CurrentPosition - 1
End Sub

Codes Sources

A voir également

Ajouter un commentaire

Commentaires

aaah ! mais c'est pas la source ou je t'ai quasiment tout fais ?????
en + c'est facile

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.