Re: WMP doesn't play a media on a thread
- From: "Alessandro Angeli" <nobody@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 May 2008 13:44:47 -0400
From: "sisimma"
Actually, my code has been running as you told.
The problem doesn't seem to relate timing. My code gives
enough time for WMP to run.
No, it doesn't.
Please give me another comment after review my code
snippet in more detail below
I did and the code you posted before was different. You now
have 2 threads:
[main]
CoInitializeEx()
CoCreateInstance()
....
put_URL()
create_thread1()
loop: mainfunction()
CoUninitialize()
[thread1]
CoCreateInstance()
....
put_URL()
loop: mainfunction()
thread1 is missing CoInitializeEx() (and CoUninitialize())
which means CoCreateInstance() is failing on thread1 and
only WMP on the main thread is playing. You are also not
releasing WMP when done. Your code should be:
[main]
CoInitializeEx()
create_thread1()
loop: mainfunction()
wait_for_thread1_to_end();
CoUninitialize()
[thread1]
CoInitializeEx()
CoCreateInstance()
....
put_URL()
wait_for_WMP_to_finish_playing_while_dispatching_messages()
release_WMP()
CoUninitialize()
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
.
- References:
- WMP doesn't play a media on a thread
- From: sisimma
- Re: WMP doesn't play a media on a thread
- From: Alessandro Angeli
- Re: WMP doesn't play a media on a thread
- From: sisimma
- WMP doesn't play a media on a thread
- Prev by Date: Re: WMP doesn't play a media on a thread
- Next by Date: Re: Just getting started, How do you get the SDK?
- Previous by thread: Re: WMP doesn't play a media on a thread
- Next by thread: How to play DVD in wmp SDK version 11?
- Index(es):
Loading