Video Chat for Android in 30 Lines of Code

Here is a simple Video Chat application I built with Flex 4 and deployed on AIR for Android. The Application is just 30 lines of code and allows multiple users to join a chat room and “video chat”.

Video streaming is powered by LiveCycle Collaboration Services, a set of hosted Flash Services that enable developers to easily add real-time collaboration and social capabilities to their applications.

This application is obviously a bare-bones proof of concept. However, it is fully operational, and the same code can run on different runtime environments: AIR for Android, AIR on the Desktop, and Flash Player in the Browser. Users can participate in the same collaboration session regardless of the runtime environment they use.

Watch the video:

The 30 lines of code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:cs="AfcsNameSpace" currentState="logon" fontSize="28">

	<fx:Script>
		[Bindable] private var roomURL:String = "http://connectnow.acrobat.com/YOUR_ROOM_NAME";

		protected function connect():void {
			auth.userName = userName.text;
			currentState = "default";
			session.login();
		}
	</fx:Script>

	<s:states>
		<s:State name="default"/>
		<s:State name="logon"/>
	</s:states>

	<fx:Declarations>
		<cs:AdobeHSAuthenticator id="auth"/>
	</fx:Declarations>

	<s:TextInput id="userName" includeIn="logon" top="200" horizontalCenter="0"/>
	<s:Button label="Connect" click="connect()" includeIn="logon" top="250" horizontalCenter="0" height="50" width="150"/>

	<cs:ConnectSessionContainer id="session" roomURL="{roomURL}" authenticator="{auth}" autoLogin="false" width="100%" height="100%" includeIn="default">
		<cs:WebCamera top="10" left="10" bottom="10" right="10"/>
	</cs:ConnectSessionContainer>

</s:Application>

100 Responses to Video Chat for Android in 30 Lines of Code

  1. Earl Ferguson July 23, 2010 at 6:08 pm #

    Nice!!!

  2. Alex Yule July 23, 2010 at 8:48 pm #

    Super cool!

  3. Lee July 24, 2010 at 6:03 am #

    30 lines of configuration does not add up to 30 lines of code.

    All the heavy lifting is done by AIR and LiveCycle.

    • Kris July 16, 2012 at 1:38 pm #

      Lee…
      Thx for stating the obvious…

    • praveen September 3, 2013 at 1:48 am #

      i want to devolop a voice chat application on android…please if u have any source code regarding this …post it… or send to my mail
      u.nagapraveen@gmail.com

  4. RBL July 25, 2010 at 7:43 pm #

    Well done! Facetime for Android.

  5. Ji July 27, 2010 at 11:26 am #

    Thank you for sharing this great tutorial! this is fantastic!

  6. warez July 28, 2010 at 6:46 am #

    Good stuff.Thank you!

  7. Tahir Alvi July 29, 2010 at 9:48 am #

    Hi,
    You do an excellent job.

    But i try to run this code in Desktop but it has following line errors

    Where we get this refrence classes.

    Thanks

  8. عبدالكريم المطيري August 15, 2010 at 12:15 am #

    video chat goot

  9. Carton Machine August 17, 2010 at 7:28 am #

    Well done! Facetime for Android.
    Carton Machine

  10. Maç Oyunları August 20, 2010 at 11:20 pm #

    Well done! Super.. Thanks…

  11. Erkek Oyunları August 20, 2010 at 11:22 pm #

    Thank you for sharing this great tutorial…

  12. Binu Mathew December 26, 2010 at 7:20 am #

    I am getting error on line no 20 and 26 i am using Flash Builder 4,
    This is the error showing
    Could not resolve to a component implementation
    Could not resolve to a component implementation

    what is the problem?

    • praveen September 3, 2013 at 1:47 am #

      i want to devolop a voice chat application on android…please if u have any source code regarding this …post it…

  13. Joe Trnka January 29, 2011 at 3:02 pm #

    Hey I am so glad I found your web site, I really found you by mistake, while I was researching on Bing for something else, Regardless I am here now and would just like to say thanks for a fantastic post and a all round entertaining blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome work.

  14. Mike March 7, 2011 at 1:08 am #

    This is not working for me. Do you have more detailed instructions?

  15. ahsan March 10, 2011 at 7:28 am #

    what is this xmlns:cs=”AfcsNameSpace”?

    • oke uwechue January 9, 2012 at 9:48 pm #

      replace it with ‘ xmlns:rtc=”http://ns.adobe.com/rtc” ‘ and recompile.

  16. madhu March 15, 2011 at 5:12 am #

    Hi ,
    I am trying to develop the video chat application. Where I have to include the above xml(script). And how to start the application coding.

  17. Johnathan Choe March 25, 2011 at 9:40 pm #

    Before moving with PODS Ripoffreport.com them

  18. cantek çetin May 9, 2011 at 2:35 am #

    Good article. Thanx…

  19. I noticed that the bounce rate on my web sites is pretty high – for most visits it is 100%. I believe my content is relevant to the search phrases I am discovered for. What do you believe may be the issue?. What exactly is a normal bounce rate for you?! Help !

  20. nhowdo June 21, 2011 at 5:06 am #

    just 30 lines, very nice

  21. Deepika June 22, 2011 at 12:45 am #

    what are all the requirements and how exactly to run this code??

  22. Deepika June 22, 2011 at 12:52 am #

    what are the requirements and how exactly to run this code??

  23. Royi Goldenberg July 1, 2011 at 6:43 am #

    Hello Christophe,

    I run the code in flash bulder 4.5.1 with lccs.swc SDK in android mobile application project and I got this compilation error :

    “ConnectSessionContainer’ declaration must be contained within the tag, since it is not assignable to the default property’s element type ‘mx.core.IVisualElement’ “.

    Thank’s for your help
    Royi.

  24. James Mew July 5, 2011 at 10:07 am #

    Does anybody have a flash 4.5.1 project that they would share

  25. elementy kute August 8, 2011 at 4:55 pm #

    Thank you for useful information. Waiting for new posts.

  26. Sgar misal August 20, 2011 at 1:31 am #

    But how to run this code on eclipse gelileo for Android Apllication

  27. Studio Videochat Bucuresti August 26, 2011 at 6:19 am #

    Nice feature, thanks for sharing!

  28. Comfy_ro August 31, 2011 at 10:21 pm #

    Thank you for sharing. Really nice!

  29. Comfy_ro August 31, 2011 at 10:22 pm #

    Thanks for sharing. Nice post!

  30. rajan September 6, 2011 at 12:57 am #

    I have used the code for conferencing. I have created my room in sdk and given proper authentication.
    My app is running without errors . But when i try to connect , all i can see is a blank window

    Could you please help me to sort out this issue

    • Bhairab Mahato April 18, 2014 at 1:10 am #

      where u create room?please explain.

  31. Nue September 6, 2011 at 7:54 am #

    Excuse me. I have some question to aks to you that how can I run this app.Because I don’t understand about Flex

  32. ramesh sudrasana March 6, 2012 at 8:32 am #

    hello
    it is very interesting post, but i can’t implement in android, can u please give me any working example or sample so i can get better idea from it
    thanx

  33. Vishal Soni March 22, 2012 at 7:18 am #

    Hello Christophe,

    I run the code in flash bulder 4.5.1 with lccs.swc SDK in android mobile application project and I got this compilation error :

    “ConnectSessionContainer’ declaration must be contained within the tag, since it is not assignable to the default property’s element type ‘mx.core.IVisualElement’ “.

    Thanks for any help,
    Vishal

    • androidLover October 15, 2013 at 10:07 am #

      r u from gujarat, india?

  34. Vishal March 22, 2012 at 7:20 am #

    Hello Christophe,
    I run the code in flash bulder 4.5.1 with lccs.swc SDK in android mobile application project and I got this compilation error :
    “ConnectSessionContainer’ declaration must be contained within the tag, since it is not assignable to the default property’s element type ‘mx.core.IVisualElement’ “.
    Thanks for any help,
    Vishal

  35. Tunahan May 16, 2012 at 7:44 am #

    Hi, i need to help for video streaming? i m coding project like that. i code server and client but my client is sending message(text) how can i send video? so for example: i must take a picture ,at per of 0.1 second and pictures streaming and send? or android has got library for that ?

  36. Dai anh Tai May 28, 2012 at 7:35 am #

    Hi.
    Can you give or sell for me full sourcecode Android Video Chat ?
    If Yes ,piease reply to my email : daianhtai2007@gmail.com

    Thank you very much.

  37. Amit July 24, 2012 at 6:21 am #

    Hello,

    Can you please share with me source code of any running android app, which implement video chating feature. I am desperately looking for any such help.

  38. Terrence August 6, 2012 at 4:14 pm #

    Greate indeed, thanks for sharing.
    Please hook us with a working man. got us hooked already

  39. Mohammed Safiq SA October 15, 2012 at 12:00 pm #

    I am getting the following error.
    How to resolve this..?

    Error –>Could not resolve to a component implementation.

  40. sam December 8, 2012 at 6:49 am #

    Lets create a full video chat component and then use that component in an application to make video chat in 1 line of code :)

  41. Shankar December 14, 2012 at 3:45 pm #

    Adobe LCCS will be shutting down on Dec 31st 2012.

    Have a look here.
    http://forums.adobe.com/message/4281122

  42. play unblocked games at school January 11, 2013 at 6:41 pm #

    I really want this kind of info. I was seeking this kind of knowledge for a period. Thank you & best wishes.
    a href=”http://fununblockedgames.com/”>unblocked games at school

    • free unblocked games April 25, 2013 at 12:47 pm #

      I have used the code for conferencing. I have created my room in sdk and given proper authentication. and it’s awesome

      • AntonyV October 18, 2013 at 7:28 am #

        Hi…!

        “http://connectnow.acrobat.com/YOUR_ROOM_NAME”

        YOUR_ROOM_NAME means what?

        how do i create room…? Please guide me…

        Thankyou…

  43. fgfg July 30, 2013 at 7:58 am #

    fg

  44. AntonyV October 18, 2013 at 7:18 am #

    Hi…. Thanks for this tutorials…

    when i use this on flash builder 4.7 it show could not resolve to a component implementation error… for cs:AdobeHSAuthenticator and cs:ConnectSessionContainer ..

    give me ur suggestions to resolve this problem….

    Thankyou…. Regards AntonyV

  45. Shems October 26, 2013 at 9:52 am #

    Please prompts!

    Thank you very much for the instructions above. But I have a problem.

    I have several applications including:
    1. Main Application
    2. Application Login
    3. Applications Take Photo

    TakePhoto.mxml (code)

    protected function view1_creationCompleteHandler(event:FlexEvent):void {
    if ( CameraUI.isSupported )
    {
    camera = new CameraUI;
    camera.addEventListener(MediaEvent.COMPLETE, onComplete);
    camera.addEventListener(ErrorEvent.ERROR, onError);
    status.text = _status;
    }
    else {
    status.text = “Camera Not Supported”;
    }
    }

    protected function captureImage():void {
    camera.launch(MediaType.IMAGE);
    }

    private function onError(event:ErrorEvent):void {
    trace (“Error has Occured”);
    }

    private function onComplete(event:MediaEvent):void {
    var mediaPromise:MediaPromise = event.data;
    status.text = mediaPromise.file.name + “\n” + mediaPromise.file.url;
    image.source = mediaPromise.file.url;
    }

    Take a photo when the application is complete, it’s back to the Application Login.
    I want when the Take Photo Applications completed, will return to the Take Photo Application back without having to Application Login.

    Thanks very much for the directions, We can be emailed me: shems.8577 @ gmail.com

    Shems,
    IND

  46. Nguyen Van Khuyen February 18, 2014 at 6:46 am #

    Dear all…
    Can you give or sell for me full sourcecode Android Video Chat ? i am learning android and working “Video chat”.
    If Yes ,piease reply to my email : khuyenvan.ng@samsung.com

  47. Bhairab Mahato April 18, 2014 at 12:53 am #

    20 and 26 line error.how can resolve it.how to create room and where?

  48. Emre Deniz April 21, 2014 at 5:06 am #

    Hi! Could you send me full source code of the project. I need this code for my lesson project please help me . Thank you for your helps. Have a nice day. my mail adress—> dennis_e00@hotmail.com

  49. Videochat April 21, 2014 at 9:23 pm #

    extremely good!

  50. thiti February 23, 2012 at 11:15 am #

    i not use error
    Could not resolve to a component implementation.
    Could not resolve to a component implementation.
    i don’t understand stucture

Trackbacks/Pingbacks

  1. Video Chat for Android in 30 Lines of Code | Lively Flash Tuts - July 23, 2010

    [...] Direct Link [...]

  2. Video chat for Android in 30 lines of code « Collaborative Methods - July 24, 2010

    [...] An interesting post from Adobe evangelist, Christophe Coenraets, where he creates a video chat application for Android in just 30 lines of configuration code, leveraging Adobe LiveCycle Collaboration Service. Grab the code and read more on his blog here. [...]

  3. Things You Should Know On SEO Link Building | developersbiz.com - July 24, 2010

    [...] Video Chat for Android in 30 Lines of Code [...]

  4. Webfavorites - July 24, 2010

    Supercooled water | video…

    I found your entry interesting, and I’ve added a Trackback to it on my weblog :) Thank You!…

  5. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC | TechZrr.com - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  6. news » Ein Fall für Luft: Adobe Evangelist Builds Video Conference App für Android & PC - July 24, 2010

    [...] man eine in Aktion zu sehen. Welches ist, warum Adobe Technical Evangelist Christophe Coenraets hat zusammen eine Demo zeigen, was AIR tun können, wenn es genutzt wird, um die gleiche Anwendung auf beiden [...]

  7. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC | blacklink-tech - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  8. Video: Flash-based video conferencing for Android demonstrated - July 24, 2010

    [...] bad it’s only a proof-of-concept.. for [...]

  9. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC | atomicgate.com - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  10. Smart Phone Top 10 » Video: Flash-based video conferencing for Android demonstrated - July 24, 2010

    [...] bad it’s only a proof-of-concept.. for [...]

  11. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC | World24 - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  12. iPhone Games » Video: Flash-based video conferencing for Android demonstrated - July 24, 2010

    [...] bad it’s only a proof-of-concept.. for [...]

  13. DVRHDMI » A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  14. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC | Movies - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  15. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC « Whella – Latest News on Wireless Topics - July 24, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  16. sarkem.org - July 24, 2010

    Executive netbook – the beginning…

    I found your entry interesting thus I’ve added a Trackback to it on my weblog :)…

  17. LG 3D TV - 3D TV AD Sony 3D, Sharp, LG, Philips etc, “TV that’ll knock you out” - July 25, 2010

    [...] Video Chat for Android in 30 Lines of Code [...]

  18. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC - Latest Technology Trends - July 25, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  19. Siskatec - July 25, 2010

    fVisiOn NTIC te hace ver conejos no significativas…

    I found your entry interesting thus I’ve added a Trackback to it on my weblog :)…

  20. Webfavorites - July 25, 2010

    How to fold | video…

    I found your entry interesting, and I’ve added a Trackback to it on my weblog :) Thank You!…

  21. Webfavorites - July 25, 2010

    How to fold | video…

    I found your entry interesting, and I’ve added a Trackback to it on my weblog :) Thank You!…

  22. Video Chat Application for Android & PC in 30 Lines of Code - July 25, 2010

    [...] [Source] Loading google.load('search', '1'); google.setOnLoadCallback(function(){ new google.search.CustomSearchControl('012240321471511227919:cz4ngqat5fa').draw('cse'); }, true); [...]

  23. Webfavorites - July 25, 2010

    Amazing ping pong skills | video…

    I found your entry interesting, and I’ve added a Trackback to it on my weblog :) Thank You!…

  24. Anonymous - July 25, 2010

    [...] [...]

  25. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC « Claire191's Blog - July 25, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  26. Webfavorites - July 25, 2010

    When Flash goes bad | video…

    I found your entry interesting, and I’ve added a Trackback to it on my weblog :) Thank You!…

  27. Webfavorites - July 25, 2010

    Funny commertial | video…

    I found your entry interesting, and I’ve added a Trackback to it on my weblog :) Thank You!…

  28. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC - New Cool Technology - July 25, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  29. Practice of Madness - July 26, 2010

    Bipolar Darkness Chapter 1 by youtube poster vigilante114…

    I found your entry interesting thus I’ve added a Trackback to it on my weblog :)…

  30. A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC | The News List - July 26, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  31. Video: Flash-based video conferencing for Android demonstrated | Go Gadget News - July 26, 2010

    [...] bad it’s only a proof-of-concept.. for [...]

  32. Video: Flash-based video conferencing for Android demonstrated « Codealis - July 26, 2010

    [...] bad it’s only a proof-of-concept.. for [...]

  33. Video: Flash-based video conferencing for Android demonstrated - July 27, 2010

    [...] bad it’s only a proof-of-concept.. for now. Tweet ThisSHARETHIS.addEntry({ title: "Video: Flash-based video conferencing for [...]

  34. 50 resources to get up to speed with the Flash Platform : Mihai Corlan - July 29, 2010

    [...] Video chat for Android using LiveCycle Collaboration Service and AIR [...]

  35. 有助于Flash平台开发提速的50个学习资源 « echo "RenYuan's Blog" - August 5, 2010

    [...] •        AIR2.5 StageWebView演示 •        AIR里的地理定位 •        关于使用LiveCycle Collaboration Service和AIR的Android的视频图表 •        使用P2P连接桌面apps的Android apps:这儿和这儿 •        [...]

  36. 有助于Flash平台开发提速的50个学习资源 – 新闻资讯 – 9RIA.com天地会 – 论坛 | 谱曲 - August 8, 2010

    [...]       AIR2.5 StageWebView演示 •        AIR里的地理定位•        关于使用LiveCycle Collaboration Service和AIR的Android的视频图表•        使用P2P连接桌面apps的Android apps:这儿和这儿•      [...]

  37. Travel in the sky › A Case For AIR: Adobe Evangelist Builds Video Conference App For Android & PC - August 10, 2010

    [...] when you can see one in action. Which is why Adobe Technical Evangelist Christophe Coenraets has put together a demo showing off what AIR can do when it’s used to deploy the same application across both [...]

  38. Multi-User Google Map Collaboration on Android - August 27, 2010

    [...] is just another example of “built-in” collaboration (go here and here for more). The point is really how easy it is to add these collaboration features to any [...]

  39. LCCS – Carte Google Maps collaborative synchronisée avec Whiteboard - Adobe Flex Tutorial - Tutoriaux Flex Builder, MXML, ActionScript, AS3 - August 27, 2010

    [...] des applications collaboratives basées sur LCCS (LiveCycle Collaboration Service). Après la vidéo-conférence et le morpion, un peu de cartographie cette [...]

  40. Multi-User Google Maps Collaboration on Android (Adobe Flash Platform Blog) - September 16, 2010

    [...] is just another example of “built-in” collaboration (go here and here for more). The point is really how easy it is to add these collaboration features to any [...]

  41. Some fantastic demos of AIR on Android by Christophe Coenraets « Greg Wilson's Ramblings - September 22, 2010

    [...] Video Chat for Android in 30 Lines of Code — 30 lines of code and you can do multi-user video chat!   Takes advantage of Adobe LiveCycle Collaboration Services [...]

  42. Videotelefonie-Technologien zur Nutzung unter Android für Senioren | Soziotechnische Integration - July 24, 2012

    [...] Conraets stellt in seinem Artikel “Video Chat for Android in 30 Lines of Code” einen Ansatz zur Entwicklung von Video-Chats, die mithilfe von Adobe Air funktionieren, vor. Um [...]

Leave a Reply