How to Stream Media?

Posted on January 24, 2015
Share article:

A question we hear every so often is “How to stream media and implement a streaming service for my web platform?”. And of course (like all good engineers) we say “That depends!”. It depends on the business model, the content, and the traffic. However, the basic setup is more often than not the same. Adding bells, whistles and load balancers is possible down the line with a little bit of planning.

The infrastructure we will present here is a typical entry-level media delivery platform and its components.

1. What do I need?

Your basic shopping list for a streaming system includes the following:

  • Multimedia Server (dedicated or SaaS)
  • Content Source
  • Client Application
  • Authentication and Tracking Services

The first three items are mandatory for any and all content delivery platforms, large or small, while authentication and tracking services are not. We can argue that the only business model compatible with a CDN without authentication is a free video repository (like Youtube) or a free live event portal. These do not require authentication before revealing content, but they do however track your interaction, provide at least viewer counters and lots of commercials and ads. Therefore it is safe to assume that your platform will have at least a tracking service if not authentication.

2. Multimedia Servers

The basic features of a multimedia server are:

  • Read recorded and published content
  • Distribute the content to subscribers (clients)
  • Track client interaction with the content
  • Provide authentication API

Of course, there is still transcoding, multi-bitrate streaming (ABR), recording, load balancing and more… But let’s focus on these four for now.
A multimedia server should be able to access content from a repository and broadcast it to subscribing clients. This is called “video on demand” or VOD for short. In addition to VOD, it should also support live streams. A client publishes live content from an application called “encoder” and the server broadcasts it to other subscribers.
The distribution is usually impaired by codec diversity and that’s when transcoding comes in handy. More on that topic will be covered in a future article.
This multi media server concept is really powerful, but the challenge lies in integrating it with an existing platform. This is where the server’s API helps. By using its API, you get notified when client events happen: client A is connected, client B is disconnected, client A started playing stream S, client A stopped playing stream S and so on. It is then up to the platform to interpret these events and take action. Another power of the API is that it allows the platform to request specific actions to be taken. For example, disconnect a client if his credit has run out while watching a video for too long.
Similar to tracking, authentication usually involves a query to the platform before a successful client connection. If the platform agrees, the client connection is accepted otherwise, the connection is rejected and the client is not able to access any content.

The most successful implementations for multimedia servers are Wowza Streaming Engine and Adobe Media Server. You can also get these as ready to run instances on Amazon EC2 which means you no longer need to worry about physical infrastructure and hardware performance.

3. Content Sources

Content is the actual object of media streaming, it is the media itself. So what exactly is media? In our case, it can be audio and video, recorded or live. By harnessing the powers of media servers it can even be a slide presentation synchronized with the video.
Recorded content is pretty straight forward. You have media files stored somewhere accessible to the media server and it will do the VOD broadcasting.
For live content, an encoder is required. It is an application that converts data from capturing devices (like a webcam or microphone) into a live stream which is published to the server. Examples of encoders are Flash Media Live Encoder (FMLE) and Wowza GoCoder.

4. Client Applications

By client application, we mean the piece of software that plays the stream on the client’s device of choice. Depending on the scope of the project, it can be a completely custom implementation or one off-the-shelf like JWPlayer, the default media player on iOS or Android, VideoLAN, and much more.

5. Authentication and Tracking

Depending on the business model, you might need to implement different levels of access to your content. A part of it could be public, another may be reserved only to members or paying customers. The way to do this is by integration with your customer database via services that connect to the media server’s API. The same goes for interaction tracking. By tracking events performed by users on your content, you can quickly optimize marketing and ad campaigns to maximize your profits.

Share article:

Start the discussion on "How to Stream Media?"


    What do you think? Share your thoughts!

    20 + = 22