Created
February 15, 2015 00:27
-
-
Save siniypin/08aba26ffea06915136d to your computer and use it in GitHub Desktop.
Create Wav player and dispose after it reaches end of the file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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