AxWindowsMediaPlayer - buffering and looping

ICW

Active member
Joined
Mar 27, 2006
Messages
25
Programming Experience
Beginner
Hi I'm a novice so any help will be gratefully received.
I have a project with the following control AxWMPLib.AxWindowsMediaPlayer which allows me to see avi files in my app.
Is there a way in the code I can get it to ;

1. Force it not to play until it has buffered the whole file (this is coz I am having probs with the playback and have set the buffersize in the media player options to 60 secs but it doesn't seem to have any effect)

2. Force it to keep looping the same video over and over.

TIA
ICW
 
Add this code to the load Event handler (to the form where WMP control resides):

VB.NET:
AxWindowsMediaPlayer1.settings.autoStart = False
' 1000 repetitions will be just enough ... 
AxWindowsMediaPlayer1.settings.playCount = 1000


And for the buffering use the WMP's event Buffering:
VB.NET:
Private Sub AxWindowsMediaPlayer1_Buffering(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_BufferingEvent) Handles AxWindowsMediaPlayer1.Buffering
 ' Here disable WMP play durring Buffering 
End Sub

Voila!!!
 
Also for the looping (repeat) you can use setMode method:

VB.NET:
AxWindowsMediaPlayer1.settings.setMode("Loop", True)

Hope this helps :)
 
Mental Hard - you're GREAT!!

The looping works fine now.
Re - the buffering bit i'm not quite sure where to put it, could you show me where in the code below?
PHP:
    Private Sub lvwfiles_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvwfiles.DoubleClick

        'If File.Exists(lvwfiles.SelectedItems(0).Text) = True Then MessageBox.Show("Yes it exists")
        Try
            Dim File As FileInfo = New FileInfo(lvwfiles.SelectedItems(0).Text)
            DirectCast(Me.Owner, _Loop).WMP1.URL = ((lvwfiles.SelectedItems(0).Text))
            DirectCast(Me.Owner, _Loop).WMP1.settings.mute = True

            DirectCast(Me.Owner, _Loop).WMP1.settings.autoStart = False
            DirectCast(Me.Owner, _Loop).WMP1.settings.setMode("Loop", True)
 


            DirectCast(Me.Owner, _Loop).lblScanDate1.Text = String.Format("File Date:     {0}", File.LastWriteTime.ToLongDateString())
            DirectCast(Me.Owner, _Loop).lblfilename1.Text = String.Format("File Name:     {0}", File.Name.ToString)
            ' DirectCast(Me.Owner, Form1).lblimageno1.Show()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            '  MessageBox.Show("You may need to be a little more accurate with your clicking", "Ooops!!")
        End Try
        Me.Close()
    End Sub
 
Back
Top