Skip to content

Instantly share code, notes, and snippets.

@siniypin
Created February 15, 2015 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siniypin/08aba26ffea06915136d to your computer and use it in GitHub Desktop.
Save siniypin/08aba26ffea06915136d to your computer and use it in GitHub Desktop.
Create Wav player and dispose after it reaches end of the file
public class PlayFileCommand : ICommand
{
private readonly ISipUserAgent _userAgent;
private readonly IContainer _container;
public PlayFileCommand(ISipUserAgent userAgent, IContainer container)
{
_userAgent = userAgent;
_container = container;
}
public void Execute()
{
var player = _container.Get<IWavPlayer>();
player.Completed += (sender, args) =>
{
System.Console.WriteLine("Player {0} has reached the end of file {1}", player.Id, player.File);
player.Dispose();
};
player.Start("NeroSoundTrax_test8_PCM_Mono_VBR_16SS_48000Hz.wav", false) ;
_userAgent.MediaManager.ConferenceBridge.ConnectToSoundDevice(player.ConferenceSlot.SlotId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment