Remote Desktop With Remotair

A day ago I published a youtube video about remote Windows control from an Android device. I will try to clarify the process about how it is done. What you need to make this work for you is (1.) an Android device with Remotair application v 0.1.9 (or higher) installed, (2.) Windows with Remotair desktop .exe air application v 0.1.3 (or higher) and (3.) some capture-desktop softwer, VH Screen Capture works good.

First, download and install VH Screen Capture, run “Configure VHScrCap” and “Create new one”, configure the instance something like this:

Specify output size to match your Android device resolution, make sure to show mouse and also do not forget to define some magnitude (moves the recording screen accordingly when cursor reaches the current recording boundaries or is near). Make sure your new desktop “webcamera” is visible in flash player / air, I usually check available cameras using onStream.

Install latest Remotair Android application on your device from Android market (its free), make sure you are connected to the internet, run it and click the big button to connect. You will obtain a channel ID

Download and install Remotair desktop executable. It has to be an .exe (extendedDesktop profiled air app) to be able to work with NativeProcess – in order to move and click mouse cursor and dispatch keyboard events.

Run the desktop app and insert generated channel ID. Now the Android app and desktop app should pair. In the desktop app click Remote Desktop tab and select VHScrCap for camera source, now select Remote Desktop option in Android device. Just make sure to click Remote Desktop tab in the desktop app first and just after that in Android app (desktop app listens for initial command after its in Remote Desktop tab). Now you are remotely controling mouse and keyboard from the Android device, see it work here:

The desktop app you have downloaded is just a demo, you can use Remotair api to build your own desktop application and to include your own functionality. Here is a source code to begin with

import sk.yoz.remotair.events.RemotairEvent;
import sk.yoz.remotair.net.Receiver;
import sk.yoz.system.SystemKeyboard;
import sk.yoz.system.SystemMouse;

var offset:Point;
var receiver:Receiver;

receiver.remotairEvents.addEventListener(RemotairEvent.INIT_REMOTE_DESKTOP, onInitRemoteDesktop);
receiver.mouseEvents.addEventListener(MouseEvent.MOUSE_MOVE, onReceivedMouseMove);
receiver.mouseEvents.addEventListener(RemotairEvent.MOUSE_LEFT_DOWN, onReceivedMouseLeftDown);
receiver.keyboardEvents.addEventListener(KeyboardEvent.KEY_UP, onReceivedKeyboardUp);

function onInitRemoteDesktop(event:RemotairEvent):void
{
    camera = Camera.getCamera(); // make sure to select VHScrCap
    camera.setMode(event.data.width, event.data.height, 10);

    stream = new NetStream(receiver.connection, NetStream.DIRECT_CONNECTIONS);
    stream.publish(event.data.channel);
    stream.attachCamera(camera);
}

function onReceivedMouseMove(event:MouseEvent):void
{
    SystemMouse.moveBy('MoveCursor.exe', event.localX - offset.x, event.localY - offset.y);
    offset = new Point(event.localX, event.localY);
}

function onReceivedMouseLeftDown(event:MouseEvent):void
{
    SystemMouse.event('MouseEvent.exe', SystemMouse.MOUSE_LEFT_DOWN);
}

function onReceivedKeyboardUp(event:KeyboardEvent):void
{
    SystemKeyboard.event('KeyboardEvent.exe', event.keyCode);
}

I would like to apologize to mac users, I do not have desktop version of app for a mac. I believe it is possible and easy to create one using Remotair api and customized native processes for mac.

I have experienced some issues running MoveCursor.exe under Windows Vista. Copying msvcr100D.dll into win/system32 fixed the issue.

5 comments so far

  1. […] Remote Desktop With Remotair […]

  2. Radu Birsan February 22, 2011 11:04

    How could I port this android app to ios. Do you think the iphone packager supports these features?

  3. Jozef Chúťka February 22, 2011 13:03

    @Radu, I believe there should not be any problem porting this code into iphone (I did not worked with packager yet). Its just that I did not released code for the android app, just the receiving api…

  4. Markus Gritsch February 24, 2011 22:18

    Very interesting stuff. I`m working on a project which should run on air for TV, too. A remote control like yours could improve user experience! Maybe you can open source it – (android + receiving) 🙂

  5. Jozef Chúťka February 25, 2011 12:47

    Hi Markus,
    the receiving api is open already I am also thinking about making transmitting api open, in fact in receiving api classes there is a lot of code common with transmitter… but for now I would like to keep my transmitting application code not open … maybe later in future.
    You can try using receiving api to create apps for your air tv and control it using Remotair android app, that would not take you more than a few hours, the api is really easy to understand. If you decide to do that please hit me when finished I would love to see it.

Leave a comment

Please be polite and on topic. Your e-mail will never be published.