Wednesday, April 25, 2012

Testing "live" stream with the Android App

After doing plenty of research on how we were going to stream the video from the Kinect to the Android app, we decided to start with saving images and creating the effect of a live stream with those images. The ImageView continuously gets updated using a simple Handler that receives update messages from a forever executing AsyncTask that connects to the server and downloads images. The Handler provided a way to update the ImageView in the UI thread (since you can only do so on this thread) while also spawning the task of downloading to a different thread (an AsynTask).

      private final Handler mHandler = new Handler() {  
           @Override  
           public void handleMessage(Message msg) {  
                switch (msg.what) {  
                case UPDATED:  
                     imageView.setImageBitmap(bitmapImage);  
                     break;  
                }  
           }  
      };  

Our test was with the above animation. There were 6 separate images of size 25kb (roughly the same as the ones created by the Kinect). The download time between each image was about 400ms. This created a pretty good video effect, so we were confident in our approach.

No comments:

Post a Comment