Search code examples
amazon-web-servicesflutteraudiovideo-streamingaudio-streaming

Most common methods to play audio and video for app users fast and efficiently?


I've seen several methods and opinions -- including streaming the media (HLS, RTSP), or just using regular mp3, AAC, mp4, etc. What is the most common method for playing audio and video for users from a database? (Eg. the user taps a play button and media plays.) Does the size of the file (length of the media) affect this choice? What is considered standard practice?

For context, I'm designing an app with Flutter using either AWS or firebase as a backend that will allow users to listen to audio (as short as 5 min, as long as 20) and eventually watch videos. Looking for a method that is efficient in bandwidth as well as fast for the end user.

Audio is my primary objective.


Solution

  • HLS streaming is the de facto approach for delivering video - especially if over 5 minutes. You'll have to encode different sizes/bitrates for different sized screens. The good thing is this will reduce bandwidth for smaller screens.

    For playback, Streaming is not natively supported in the browser, you'll need a JS player to play back the video (video.js is a good one).

    There are APIs and services that will encode your videos, host them, and provide you with a player to playback the video (upload the video, and get the playback url). I work for api.video but there is also Mux and others that can save you a lot of headache in building your app.