Enabling instant video streaming for Android applications
AVLib is an example of overcoming a technological obstacle and coming up with an elegant and flexible solution that had no equivalent on the market.
Onix’ team encountered the problem while working on YouStream, our live streaming mobile application. The app had to stream video and audio data at its maximum capacity through the phone’s camera and to restream video from action cameras like GoPro. It was also necessary to enable support of Android 4.1 as the minimum version, so that users with older mobile devices could use the application, and to offer a number of convenient usability settings.
Onix team conducted thorough research to compare existing streaming libraries. It turned out there was no solution in the market that could perfectly meet our technical needs.
Existing eligible solutions were raw and full of bugs, commercial libraries worked worse than open-source ones, and none of them could stream from action cameras and be stable on low Internet connection.
The team quickly decided to create our own external library that could support RTMP streaming for Android. Since there is a vast number of Android devices and OS versions currently in use, this library was to support streaming needs of all current Android users.
It was also our ambition to build a flexible and simple RTMP library that any other Android team or developer could integrate into their app. The library should be lightweight, and allow integration with two clicks. And we did it!
The RTMP library, which we called AVLib, took a few months to develop.
To endow it with a high capacity potential, our team chose the C programming language. The modules which were in charge of encoding, work with RTMP, and up to processing, were built using pure C for maximum performance of the whole system.
The development process was full of challenges and required significant effort and ingenuity from our team. The entire encoding pipeline and RTMP protocol were implemented in the native module for maximum performance. One of the challenges was to enable AVLib to stream video and audio from action cameras on the fly. To enable this feature, simultaneous work with two network interfaces on the side of the module in C was required. Making two networks work correctly required thorough research of the source code of Android OS and continuous debugging.
At one point, the developers had to patch libRtmp and solve the problem of simultaneous work with two network interfaces. The trickiest part was to make libRtmp work with a socket bound to the selected network. The problem was that the system after random periods of time was closing the socket created on Java side for a certain network and passed to the libRTMp maze. We did it another way: bound the socket created inside libRtmp via fwmarkd to the specified network.
Another significant challenge was enabling smooth work with the camera and processing of the broadcast life cycle on different devices. That was rather time-consuming and required careful scrutiny.
The resulting solution is AVLib (aar library) + demo with several pages + custom license which allows using the product for commercial purposes without opening sources.
A redesign, mainly focusing on user experience improvements, followed. Along with a few more features, it helped raise the number of downloads.
Everything looked safe and steady, so we embarked on turning the MVP into a full-fledged app targeting advanced game streamers. However, after an ordinary update with bug fixes, GP rejected it. Communication with the support concerned an alleged violation of the Impersonation and Intellectual Property policy. Finally, we figured out that the app’ s icon was the reason.
The update was approved only after we had tried out several new icon designs and refreshed the entire app’ s visual design.
Google Play kept rejecting updates for about three weeks. Finally, for no apparent reason, the number of installs across all countries plummeted.
AVLib combines all the desired features and comprehensively solves the basic task of video broadcasting. AVLib allows streaming from phones and action cameras to any RTMP server and ensures instant stream recording. The library’ s SDK is compatible with such RTMP servers as Wowza and YouTube.
AVLib is a ready-to-use tool for Android Studio, the first of its kind on the market. The software product consists of libraries for ARM (+ARM 64) platforms and Java module. The library comes as one .aar file without any dependencies.
AVLib perfectly fulfills the following principles:
Easy integration with Android apps
Support of all existing types of Android devices
For Whom This Product Is
© 2000 – 2021 Onix-Systems, LLC