It was almost end of my time with the startup I was working, finishing my Qt/C++ based desktop application assignment, when I came to know that their Android application is having some major issue with Android Lollipop as it use to crash at start itself. Time was around end of April and although I knew there was some problem with Android app on Lollipop earlier but I cared less as I had my own stuff to take care of and honestly I had absolutely no idea about the problem leave alone the solution to it. But around this time I was bit free and relaxed so I started taking interest in the solution for problem.
At that time I knew little about Android programming, even running Android Studio only once in past. But after working on numerous problem on desktop application for last ~3 months I was in a different state of mind, kind of enjoying solving problems.
Initially after running project on Android Studio it showed some errors with camera API usage and I thought issue might be because of some deprecated class of Android’s Camera API on Lollipop as with Lollipop Google had introduced Camera2 APIs which they claimed to be much better and resourceful. I’m not sure if they are better but definitely provide more control over device’s camera module. I didn’t had a Lollipop running phone at that time which made it difficult to exactly find the problem. With this thesis of camera issue, me and everyone in team thought it would be easy fix and so I started trying out camera 2 API. But to my disappointment issue was not because of original Camera code rather a problem with video encoding profile used capturing camera feed through MediaRecorder class. There started my real learning with Android development. Actually it was good that issue with app was not a small problem as it provided me opportunity to learn Android. From then it took about a month and half to properly solve the problem with app. In this time I learned basics of Android development, got used to slow(actually super-slow) Android Studio, learned H264 encoding-decoding, some bits of RTMP protocol and a lot more.
At start it wasn’t easy as last time played with Java code was back in 2008-09 during college and that too was more of a copy-paste to complete Java course assignments. Also, there was some pressure from the company guys, I don’t know why but they put all their hope of a running Android app on me. Funny! There was even a time when I thought lets do something with native C++ on Android to find the solution to problem. It took some time, a number of sleepless nights and a lot frustration but gladly I got the solution finally.
I learned different Android modules while finding fix for the app’s video encoding problem such as camera, OpenGL, filesystem, media encoding, audio-video recording, etc. My success in solving the problem was possible only because of some nice Google samples and related open-source projects. Anyone trying to do something with streaming on Android or camera can get benefited with following projects,
- Grafika – without doubt one of the best sample there to learn camera and graphics rendering on Android.
- Kickflip Android SDK – great for HTTP streaming.
- libstreaming – one of my favorite project, helped understanding H264 and streaming in general a lot.
- MediaRecorder sample – Nothing fancy here but this can help getting started with Android audio-video recording.
- MP4Parser – if particularly interested in MP4, H264, AAC this can help getting some enlightening.
I’ll write more about my Android app development experience in coming days. I’m also planning to publish my first app on Google Play hoping it comes out good