Open Access

Architecture of a Custom HLS Player for iOS: Managing the Media Stream, Buffering, and Playback State

4 Independent Researcher Dubai, UAE

Abstract

Video was projected to account for about 74 percent of global mobile data traffic at the end of 2024, and HTTP Live Streaming (HLS) is the adaptive streaming protocol natively supported by Apple platforms. On iOS, the system player AVPlayer resolves startup, buffering, and quality switching through an internal policy, which limits control over these trade-offs. This article aims to describe and justify an architecture of a custom HLS player for iOS that manages the media stream, buffering, and playback state without AVPlayer. The study combines a systematic review of 21 sources published from 2020 to 2025, content analysis of the HLS specification draft, comparative analysis of bitrate adaptation strategies, and a case study of the author's player built for the Telegram iOS Contest 2024. The results include a seven-layer reference architecture, a ten-state playback state machine, a three-zone buffer policy, and a decision matrix for four content scenarios. Explicit, configurable policies make the trade-off between startup time and stall resilience controllable. The findings will interest iOS engineers, streaming architects, and mobile multimedia researchers. The case study is grounded in the published contest submission and its source-code commit, distinguishing implemented queue-based scheduling and sample-buffer rendering from proposed architectural extensions.

 

Keywords

References

Pantos, R. (Ed.). (2025). HTTP Live Streaming 2nd edition (Internet-Draft draft-pantos-hls-rfc8216bis-17). Internet Engineering Task Force. https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-17
Barakabitze, A. A., Barman, N., Ahmad, A., Zadtootaghaj, S., Sun, L., Martini, M. G., & Atzori, L. (2020). QoE management of multimedia streaming services in future networks: A tutorial and survey. IEEE Communications Surveys & Tutorials, 22(1), 526-565. https://doi.org/10.1109/COMST.2019.2958784
Licciardello, M., Grüner, M., & Singla, A. (2020). Understanding video streaming algorithms in the wild. In A. Sperotto, A. Dainotti, & B. Stiller (Eds.), Passive and active measurement (Lecture Notes in Computer Science, Vol. 12048, pp. 298-313). Springer. https://doi.org/10.1007/978-3-030-44081-7_18
Spiteri, K., Urgaonkar, R., & Sitaraman, R. K. (2020). BOLA: Near-optimal bitrate adaptation for online videos. IEEE/ACM Transactions on Networking, 28(4), 1698-1711. https://doi.org/10.1109/TNET.2020.2996964
Yan, F. Y., Ayers, H., Zhu, C., Fouladi, S., Hong, J., Zhang, K., Levis, P., & Winstein, K. (2020). Learning in situ: A randomized experiment in video streaming. In Proceedings of the 17th USENIX Symposium on Networked Systems Design and Implementation (NSDI '20) (pp. 495-511). USENIX Association. https://www.usenix.org/conference/nsdi20/presentation/yan
Taraghi, B., Nguyen, M., Amirpour, H., & Timmerer, C. (2021). Intense: In-depth studies on stall events and quality switches and their impact on the quality of experience in HTTP adaptive streaming. IEEE Access, 9, 118087-118098. https://doi.org/10.1109/ACCESS.2021.3107619
Zhang, X., Ou, Y., Sen, S., & Jiang, J. (2021). SENSEI: Aligning video streaming quality with dynamic user sensitivity. In Proceedings of the 18th USENIX Symposium on Networked Systems Design and Implementation (NSDI '21) (pp. 303-320). USENIX Association. https://www.usenix.org/conference/nsdi21/presentation/zhang-xu
Durak, K., Akcay, M. N., Erinc, Y. K., Pekel, B., & Begen, A. C. (2020). Evaluating the performance of Apple's low-latency HLS. In 2020 IEEE 22nd International Workshop on Multimedia Signal Processing (MMSP) (pp. 1-6). IEEE. https://doi.org/10.1109/MMSP48831.2020.9287117
Zhang, B., Teixeira, T., & Reznik, Y. A. (2022). Performance of low-latency DASH and HLS streaming in mobile networks. SMPTE Motion Imaging Journal, 131(7), 26-34. https://doi.org/10.5594/JMI.2022.3180777
Bentaleb, A., Zhan, Z., Tashtarian, F., Lim, M., Harous, S., Timmerer, C., Hellwagner, H., & Zimmermann, R. (2022). Low latency live streaming implementation in DASH and HLS. In Proceedings of the 30th ACM International Conference on Multimedia (pp. 7343-7346). Association for Computing Machinery. https://doi.org/10.1145/3503161.3548544
International Organization for Standardization & International Electrotechnical Commission. (2020). Information technology. Multimedia application format (MPEG-A). Part 19: Common media application format (CMAF) for segmented media (ISO/IEC Standard No. 23000-19:2020, 2nd ed.). https://www.iso.org/standard/79106.html
Lim, M., Akcay, M. N., Bentaleb, A., Begen, A. C., & Zimmermann, R. (2020). When they go high, we go low: Low-latency live streaming in dash.js with LoL. In Proceedings of the 11th ACM Multimedia Systems Conference (pp. 321-326). Association for Computing Machinery. https://doi.org/10.1145/3339825.3397043
Bentaleb, A., Begen, A. C., Harous, S., & Zimmermann, R. (2021). Data-driven bandwidth prediction models and automated model selection for low latency. IEEE Transactions on Multimedia, 23, 2588-2601. https://doi.org/10.1109/TMM.2020.3013387
Turkkan, B. O., Dai, T., Raman, A., Kosar, T., Chen, C., Bulut, M. F., Zola, J., & Sow, D. (2022). GreenABR: Energy-aware adaptive bitrate streaming with deep reinforcement learning. In Proceedings of the 13th ACM Multimedia Systems Conference. Association for Computing Machinery. https://doi.org/10.1145/3524273.3528188
Narayanan, A., Zhang, X., Zhu, R., Hassan, A., Jin, S., Zhu, X., Zhang, X., Rybkin, D., Yang, Z., Mao, Z. M., Qian, F., & Zhang, Z.-L. (2021). A variegated look at 5G in the wild: Performance, power, and QoE implications. In Proceedings of the 2021 ACM SIGCOMM Conference (pp. 610-625). Association for Computing Machinery. https://doi.org/10.1145/3452296.3472923
Raca, D., Leahy, D., Sreenan, C. J., & Quinlan, J. J. (2020). Beyond throughput, the next generation: A 5G dataset with channel and context metrics. In Proceedings of the 11th ACM Multimedia Systems Conference (pp. 303-308). Association for Computing Machinery. https://doi.org/10.1145/3339825.3394938
Hort, M., Kechagia, M., Sarro, F., & Harman, M. (2022). A survey of performance optimization for mobile applications. IEEE Transactions on Software Engineering, 48(8), 2879-2904. https://doi.org/10.1109/TSE.2021.3071193
Bentaleb, A., Lim, M., Akcay, M. N., Begen, A. C., & Zimmermann, R. (2021). Common media client data (CMCD): Initial findings. In Proceedings of the 31st ACM Workshop on Network and Operating Systems Support for Digital Audio and Video (pp. 25-33). Association for Computing Machinery. https://doi.org/10.1145/3458306.3461444
Shokri Kalan, R., Farahani, R., Karsli, E., Timmerer, C., & Hellwagner, H. (2022). Towards low latency live streaming: Challenges in a real-world deployment. In Proceedings of the 13th ACM Multimedia Systems Conference. Association for Computing Machinery. https://doi.org/10.1145/3524273.3532904
Telegram Contest. (2024). iOS Contest 2024: Bold Wasp entry and public issue report. https://contest.com/ios2024/entry5672
Bezdenezhnykh, M. (2024). Telegram-iOS: HLS player implementation, commit f2dc0a0e312143be12581cd4339176405ff2198f [Source code]. GitHub. https://github.com/maximbezd99/Telegram-iOS/commit/f2dc0a0e312143be12581cd4339176405ff2198f
Telegram Contest. (2024). iOS Contest 2024: Official results. https://contest.com/ios2024

Most read articles by the same author(s)

1 2 3 4 5 6 7 8 9 10 > >> 

Similar Articles

1-10 of 37

You may also start an advanced similarity search for this article.