For the past few months we have developed an app focusing on interacting with contestants in live broadcasting, supporting thousands of subscribers and implementing a gamification/rewarding system. The game is juggling with different frameworks such as TokBox, Red5, AWS but also web socket (using BlueSocket from IBM for iOS) and written in Swift 4. Today, I’m going to share with you different tips to keep in mind when developing live video streaming mobile apps on iOS.
#1 Non-scalable architecture
Live video streaming is a sensitive matter and performance is key for these kinds of applications. For example, you want to minimize as much as possible the latency between the publisher and the subscriber if possible to under 2 seconds.
It’s important to carefully pick the server solution that could switch server and redistribute the audience to different nodes in order to avoid server overload. We decided to go with Red5 Pro as they provide a scalable solution and live support.
For realtime interacting with the publisher (up to 24 contestants), we chose to use web sockets and Tokbox.
Separating services based on the user role allows us to optimize bandwidth use on our different servers, save mobile device battery, and reduce the error introduced by overuse of services.
#2 Not enough testing, pushing to edge case scenario
As developers, we tend to often use the simulator than real devices, and there are gesture events we could easily reproduce with a real iOS device than a simulator. Good for you if you never press the home button by mistake and realize you can still hear the app in the background, or worse the app crashes!
Here are few tests to strongly consider when building a live video streaming mobile app on iOS:
- If you are using many dependencies like we did, make sure those dependencies can work together. As video is heavily relying on AVFoundation, and probably they use a shared manager for controlling audio, video bitrate etc. there will be a strong possibility that one video framework will impact an another one. For example, keep an eye on the subscribed live stream and detect if there’s a pause when you start to publish a video feed from the iOS device.
- Track performances using the Instrument Tools coming with Xcode on a device, when you start to overload your app. Make sure that CPU use is not too high, and that the memory is not increasing overtime.
- Use the app and go to background. You’ll be surprised by the number of unexpected behaviors you could raise during your dev testing!
- Test your app with another app using audio such as iTunes, Spotify etc.
- Confirm that when you are publishing something from the iOS app, the server receives your video stream. It goes both ways!
By doing those tests, you will detect early on if a framework is suited based on your need, and maybe switch if needed early in the iOS development process. You’d have more time to optimize your mobile app and increase performance. Good performance means happy client!
#3 Forgetting good / average and bad network conditions
Most of the framework are handling different network conditions, lowering the bitrate if needed. But what about your app? If the stream dropped during the game, what your app should do? And what if the live show goes back on? Those are the question you need to consider when developing those live streaming mobile apps on iOS.
When coding iOS app we tend to forget that the average user is using his phone everywhere, from the comfortable Wi-Fi to a subway. Feel free to overuse Reachability framework to detect network changes and adapt your UI accordingly.
#4 Not aware of new releases / new devices.
Usually October is a critical month for every iOS developer. Why? Because usually after all the announcement at the WWDC, there’s new release of iOS, sometimes new devices. We started our development couple months before, and it happened that we had not tested enough our UI on iPhone X devices, and that we had to switch from Swift 3 to Swift 4. Communicate properly with your product owner, raise appropriate concerns and be ready for changes!
Those little tips are coming from our personal experience and can help anyone if you decide to jump into live video streaming mobile apps on iOS. There are a lot of different factors to think of, that we tend to forget naturally but don’t forget also that you are developing a fun app as well!
Safe coding!
Want to leave it to the experts?
If you are ready to chat about how you can incorporate live video streaming mobile apps on iOS into your business? We have an experienced team ready & happy to help you out. Contact us today.