Media Player

  • Thread starter Thread starter Jerry Natkin
  • Start date Start date
J

Jerry Natkin

Has anyone here had any experience controlling Windows Media Player from an
Access form? I'm looking for code for just the basic operations: play an
mp3/wma/wav/avi, as well as some playlist management.

Thanks in advance.

Jerry Natkin
 
Doug,

I tried it, tested it thoroughly in immediate mode, and it worked fine.
However, when I incorporated it into my program it worked once, and the
next time gave me a very noisy error message to the effect that an alias
was still in use. I had forgotten to use "Close_MP3". Since then, it
won't play at all, even after rebooting. Any suggestions?

Jerry
 
Sorry, I've never seen that behaviour before, so I can't even think where to
start looking.

Does it still play from the Immediate window?
 
Sorry, I've never seen that behaviour before, so I can't even think
where to start looking.

Does it still play from the Immediate window?

No, it doesn't. In fact, it doesn't even work in the entirely separate
environment where it developed and tested it. I'm guessing that a registry
value got corrupted. I'll try a registry cleaner.

Jerry
 
Wouldn't you know it would turn out to be something monumentally silly: the
mp3 file I was using in the testing got corrupted, & I kept using it over &
over. Arrrgh!

Jerry
 
Thanks for reporting back. Glad to know it wasn't my code's fault!

No, your code works fine.

One additional question. "Play_MP3" seems to start the player and return
while it's still running. Therefore following it with a "Close_MP3" causes
it to stop playing immediately. Is there any way to detect whether it's
finished playing, in order to time the "Close_MP3" call & avoid trying to
reuse the alias - which caused my difficulties in the first place.

Thanks,
Jerry
 
Try:

Function GetStatus(Alias As String) As String
Dim nReturn As Long
Dim sReturnString As String * 255

nReturn = mciSendString("status " & Alias & " mode", sReturnString, 255,
0)
GetStatus = TrimNull(sReturnString)

End Function

That should return "playing" if it's playing, and nothing if it isn't.
 
Damn word wrap. <g>

Hopefully it's obvious that the line 0) is actually a continuation of the
line above it.
 
Damn word wrap. <g>

Hopefully it's obvious that the line 0) is actually a continuation of
the line above it.

Yeah, I caught it. Thanks for the code; it should make it very easy to
control my application, & be able to start & stop the audio as needed. I
greatly appreciate your helpfulness.

Jerry
 
Doug,

I used the routine in my program. It works fine for a single file, but
has problems with a playlist, especially of very brief recordings - which
my app. uses. I think this can only work in controlling a playlist if we
check for finishing very infrequently. Otherwise, putting it in a loop
tends to slow the machine to a crawl. If I could access the playing time
I could probably make it work; I know there must be such a field
somewhere on the recording, but haven't found it in any of the format
descriptions I've checked, including yours. Any ideas?

Thanks,
Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top