I am trying to build a VB 6 Program to control movie files being played in Windows Media Player. I need to detect when a movie finishes and when to play the next movie so it rotates automatically.
With MSDXM.OCX the endofstream event works fine. However the movie buffering is slow.
I wish to use WMP.DLL , but the endofstream event doesnt work. Anyone has any workaround? My code sample as follows:
Option Explicit
Const FileLocation = "C:\temp\ADVERTISEMENT\"
Const MaxCount = 3
Private Sub Form_Load()
PlayFile (1)
End Sub
Public Sub PlayFile(ByVal Count As Integer)
'Opens the file selected from the Object
Dim Filename As String
'Need Checking on Valid File
Filename = "Ad" & Count & ".wmv"
MsgBox (WindowsMediaPlayer1.Statu
s)
WindowsMediaPlayer1.openPl
ayer (FileLocation & Filename)
WindowsMediaPlayer1.curren
tPlaylist(
)
End Sub
Public Sub WindowsMediaPlayer1_EndOfS
tream(ByVa
l Result As Long)
If Count <= MaxCount Then
Count = Count + 1
PlayFile (Count)
Else
WindowsMediaPlayer1.Close
End If
End Sub
Start Free Trial