August 2007
8/30/07
Build your own AV Client
8/28/07
8/27/07
8/23/07
8/9/07
8/6/07
Thursday, August 30, 2007
A few weeks ago I was trying to analyze some issues in our audio and video code. I decided that while we have great test tools, it would be interesting to write a managed code AIM client that only did audio and video. The idea was this client could be used to isolate issues like memory allocation and performance. Writing this client is actually easy thanks to Open AIM. I am attaching the actual c-sharp file so everyone can look at or even copy and paste the code. But I will also go over the basic steps to create this client or for that matter any c-sharp client. Download the full code here.
1) Start Visual Studio and create a c-sharp command line project (test tools are easier as command line projects, though you can create a full ui client too.)
2) Import the acccore.dll so you can create the main AIM session object.:
[DllImport("acccore.dll", EntryPoint="#111", PreserveSig=false)]
private static extern void AccCreateSession(
[MarshalAs(UnmanagedType.LPStruct)] Guid riid,
[MarshalAs(UnmanagedType.IDispatch)] out object session);
3) Create the main AIM session, pass in your developer key and sign on to AIM:
object o;
AccCreateSession(typeof(IAccSession).GUID, out o);
s = (AccSession)o;
s.ClientInfo.set_Property(AccClientInfoProp.AccClientInfoProp_Description,
"client name (key=KEY GOES HERE)");
s.Identity = username;
s.SignOn(password);
4 ) Add a command listener to capture the commands being typed in at the command prompt. See class InputEvent for implementation details.
5) Start an audio session:
if (m_avManager == null)
m_avManager = (IAccAvManager)s.GetSecondaryManager((int)AccSecondarySessionServiceId.AccSecondarySessionServiceId_AudioVideo);
m_avSession = m_avManager.CreateSession(userName, 0);
6) Quit an audio session:
if (state != AccSecondarySessionState.AccSecondarySessionState_Offline)
m_avSession.EndSession();
m_avSession = null;
Those are the basics. Handling a multiparty audio session or peer-to-peer video is just as easy as repeating steps 5 and 6 for those types. The sample also shows how to implement events for session state or even how to handle, monitor and select input and output devices. We have made audio and video very powerful and yet very simple to implement. Give the code a glance and try implementing a client like this yourself. You might find it fun and useful.
gregsblog at 2:44:00 PM EDT Blog about this entry
Build your own AV Client
1) Start Visual Studio and create a c-sharp command line project (test tools are easier as command line projects, though you can create a full ui client too.)
2) Import the acccore.dll so you can create the main AIM session object.:
[DllImport("acccore.dll", EntryPoint="#111", PreserveSig=false)]
private static extern void AccCreateSession(
[MarshalAs(UnmanagedType.LPStruct)] Guid riid,
[MarshalAs(UnmanagedType.IDispatch)] out object session);
3) Create the main AIM session, pass in your developer key and sign on to AIM:
object o;
AccCreateSession(typeof(IAccSession).GUID, out o);
s = (AccSession)o;
s.ClientInfo.set_Property(AccClientInfoProp.AccClientInfoProp_Description,
"client name (key=KEY GOES HERE)");
s.Identity = username;
s.SignOn(password);
4 ) Add a command listener to capture the commands being typed in at the command prompt. See class InputEvent for implementation details.
5) Start an audio session:
if (m_avManager == null)
m_avManager = (IAccAvManager)s.GetSecondaryManager((int)AccSecondarySessionServiceId.AccSecondarySessionServiceId_AudioVideo);
m_avSession = m_avManager.CreateSession(userName, 0);
6) Quit an audio session:
if (state != AccSecondarySessionState.AccSecondarySessionState_Offline)
m_avSession.EndSession();
m_avSession = null;
Those are the basics. Handling a multiparty audio session or peer-to-peer video is just as easy as repeating steps 5 and 6 for those types. The sample also shows how to implement events for session state or even how to handle, monitor and select input and output devices. We have made audio and video very powerful and yet very simple to implement. Give the code a glance and try implementing a client like this yourself. You might find it fun and useful.
gregsblog at 2:44:00 PM EDT Blog about this entry
This entry has 6 comments: (Add your own)
-
Hello, Greg!
Could you give me a clue why even in your application the callback OnAudioLevelChange never is called?
In the AIM client 6.1 it is called (I have monitored it by this tool: http://www.gusverdun.com/corewitness/), but I have never seen this callback called neither in our applicatin, nor in mine custom client
Thanks,
Kirill (gribunin@zelnet.ru) -
Cool! Now this blog is getting interesting!
-
http://lesbian-sex-pics.dl.am Lesbian Sex Pics
Love to see Lesbians Kissing, Lesbian Threesomes, Lesbian Anal Sex, or just to
look at FREE Lesbian Sex Pics?
Visit: http://www.Lesbian-Sex-Pics.dl.am?Lesbian-Sex-Pics -
(I regret my last post...there are some excellent, dedicated QA folks here. They know who they are).
12/21/07 11:21 AM