.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 28th, 2013, 07:18 AM
Aleksei423 Aleksei423 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 Aleksei423 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 53 sec
Reputation Power: 0
Lightbulb How to play back media in a softphone

Hello,

I am working on a project to develop a softphone and I need to play back media in my softphone. I am using this sample program provided by Ozeki VoIP SIP SDK: google -> voip-sip-sdk.com/p_406-voip-media-handling-voip

So here is my project:

Playing an uncompressed .wav audio file, I needed to find and open one. Ozeki VoIP SIP SDK provided me a useful tool WaveStreamPlayback that is for audio playing in case of .wav files.

The WaveStreamPlayback is a MediaHandler that can be initialized by setting the audio file to be played. I could do this by adding the filename (if it is in the same directory as the program) or the file path. I could also specify the repetition, the packetization time and if it is necessary I could set that a cache stream needs to be used.

In the sample program the audio file to play is specified by a textbox element. In this textbox I could give the file path or filename to be played. I could also use the Open button to pop up a browsing window where I could browse for the proper audio file.

When the audio file is specified, I could start playing with pressing the Start button on the GUI. If every parameter is set properly the playback will start buttonStartPlayback.Text = "Pause";

Code:
1.	    WaveStreamPlayback.StartStreaming();  
2.	    WaveStreamPlayback.IsStreaming = true;  
3.	}  


The Start button is also used for pausing a started stream. The difference between pausing and stopping a stream is that in the case of pausing, I could restart the streaming from the exact point it has been paused. In case of stopping the restart will be started from the beginning of the file.

Code:
1.	buttonStartPlayback.Text = "Start";  
2.	WaveStreamPlayback.PauseStreaming();  
3.	WaveStreamPlayback.IsStreaming = false; 


If I wanted to stop the audio streaming, I needed to press the stop button and the following code will run

Code:
1.	textBoxRecordingFile.Text = string.Empty;  
2.	if (WaveStreamPlayback != null)  
3.	{  
4.	        WaveStreamPlayback.StopStreaming();  
5.	        buttonStartPlayback.Text = "Start";  
6.	        speaker.Stop();  
7.	        connector.Disconnect(WaveStreamPlayback, speaker);  
8.	        WaveStreamPlayback.Dispose();  
9.	        WaveStreamPlayback = null;  
10.	}  


The audio stream playing could also be used for playing an audio file into a call. In this case I needed to connect the WaveStreamPlayback object to the PhoneCallAudioSender object with the connector. In that case the StartStreaming() method will play the audio file directly into the established call.

You can find more useful information about other VoIP technologies on the website.

Good developing!

Aleksei Gladisev

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > How to play back media in a softphone

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap