Player a wav file - not working quite right

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Weird, but with the following code:

OpenNETCF.Multimedia.Audio.Player player = new
OpenNETCF.Multimedia.Audio.Player()
player.Play(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SAMS_PDA.NewJobsUpdate.wav"));
player = null;

I can only seem to get the player to play half of the file (doesn't matter
what .wav file it is either)

What am i doing wrong???

Many Thanks
Rob
 
The player is asynchronous. Don't kill it until you got an event signalling
that it is done playing
 
Alex,

Even if i take the player = null part out it still doesn't play all of it.

Do i need to start it on a new thread or something?

Thanks
 
You need to move the variable definition outside of the function. Otherwise
it becomes garbage-collected. Also you need to make sure that the
application does not exit until playback is completed
 
Fantastic, thank you Alex.

Alex Feinman said:
You need to move the variable definition outside of the function. Otherwise
it becomes garbage-collected. Also you need to make sure that the
application does not exit until playback is completed
 
Back
Top