We built a live broadcasting app focused on interacting with audience members, supporting thousands of subscribers, and implementing a gamification system. The game juggles different frameworks, such as TokBox, Red5, AWS, and web socket (BlueSocker from IBM for iOS), written in Swift 4. Today we’re sharing some common mistakes often made while developing live video streaming apps for iOS.
1. Non-scalable architecture
Live video streaming is a sensitive matter, and performance is key for these kinds of applications. An example of this is that you should minimize the latency between the publisher and the subscriber to under 2 seconds if possible.
To avoid server overload, it’s important to carefully select the server solution that could switch servers and redistribute the audience to different nodes. We chose Red5 Pro because they provide a scalable solution and live support.
For real-time interaction with the publisher for up to 24 contestants, we chose 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 testing enough
As developers, we tend to use the simulator instead of real devices. We should test on real devices to ensure everything runs smoothly. In fact, there are gesture events we can easily reproduce with a real iOS device. Rather than opting for the simulator, test on a real device
Here are few tests to consider when building a live video streaming mobile app for iOS:
- Make sure the dependencies can work together if you use many dependencies like we did. Since video heavily relies on AVFoundation and probably uses a shared manager to control things like audio and video bitrate, one video framework may impact another.
- Track performances using the Instrument Tools coming with Xcode on a device when you start to overload your app. Make sure that the CPU use isn’t too high and the memory isn’t increasing over time.
- 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 like iTunes or Spotify.
- Confirm that the server receives your video stream when you publish something from the iOS app. It goes both ways!
These tests will tell you whether a particular framework meets your needs. If not, you may need to switch to another framework early in the iOS development process. When necessary, switching early gives you more time to optimize your mobile app and improve its performance. Good performance means a happy client!
3. Forgetting about network conditions
Most of the frameworks handle different network conditions and lower the bitrate if needed. What about your app? If the stream drops during the game, what your app should do? What if the live show comes back on? You should consider these questions during your development process.
When coding iOS apps, we tend to forget that the average user uses their phone everywhere. Feel free to overuse Reachability framework to detect network changes and adapt your UI accordingly.
4. Being unaware of new releases and devices
October is a critical month for iOS developers. Why? There’s usually a new iOS or Apple product release after the Worldwide Developers Conference. Test on new releases and devices, communicate with your product owner, raise any concerns you may have, and be prepared to make changes as necessary!
These tips come from our personal experience and may help you avoid problems as you develop live streaming apps for iOS. It’s easy to forget about things when there are so many factors to consider. Be sure to think everything through, test extensively, and keep an eye out for new releases. Happy coding!