I'd like to play mp3 files (b/c they compress smaller than .wav's) from a vb6 app but without needing any other player installed.
Any suggestions?
I'd like to play mp3 files (b/c they compress smaller than .wav's) from a vb6 app but without needing any other player installed.
Any suggestions?
Not sure whether you would consider it as "being installed" since it comes with the OS, but you can control windows media player from vb6.
Add reference to ActiveMovie control type library and use FilgraphManager.RenderFile. Take a look at VbAmp Player's docPlayer.pvLoadMediaFile for sample and check out the usage of IBasicAudio thoughout the source -- volume control, etc.
cheers,
</wqw>
The easiest way to play an MP3 in VB6 is using the MCI in windowsmultimedia (winmm) functions. These are available in all versions of windows that can play MP3s in windows media player (by default in 2000, XP and I believe 98, needed to install Windows media player for NT4 and 95). Add the following to your header:
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
lpstrCommand As String, ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Then add the following in your subroutine:
CommandString = "open """ & FileName & """ type mpegvideo alias " & FileName
RetVal = mciSendString(CommandString, vbNullString, 0, 0)
The file type should mpegvideo not wavfile or sequencer, I guess because it uses the mpegvideo codec to play the file back. Legal questions relating to use of the MP3 codec and whether or not you are using windows to play it back or not is left up to your legal department if you plan to distribute your application.