Pseudo Streaming in Flash

Every HTML5 browser supports the ability for players to seek to not-yet-downloaded portions of a video. This functionality, often referred to as pseudo-streaming, is great for any video longer than a few minutes.

Unfortunately, this functionality is not available by default when playing videos in Flash. A work-around is possible though, by installing a web server module and adding the startparam option to your player setup.

How It Works

Pseudo-streaming works as follows: When the video is initially loaded, the player reads and stores a list of seekpoints as part of the video's metadata. These seekpoints are offsets in the video (both in seconds and in bytes) at which a new keyframe starts.

When a user seeks to a not-yet-downloaded part of the video, the player maps this seek to the nearest seekpoint. Next, the player does a request to the server, adding the seekpoint as a querystring parameter:

http://example.com/videos/bbb.mp4?start=30.4

A special module in the webserver handles this request. It reads the video in memory and checks the seekpoints metadata. It finds and skips to the offset requested by the querystring parameter. It then returns the video to the browser, starting from that offset.

Because the first frame in each return is a keyframe, the player is able to correctly load and play it. Should the server have returned the video from an arbitrary offset, the player would not be able to pick up the stream and the display would only show garbage.

Server Modules

As said, Flash pseudo-streaming does not work by default on any web server. A server side module is needed to enable it. Here are the most widely used (and open source) modules for this:

Please refer to the project pages and documentation of these modules to learn how to build and install them. This falls outside the scope of the JW Player documentation.

Several CDNs (Content Delivery Networks) support Flash Pseudostreaming as well. We have done successful tests with Bitgravity (MP4 + FLV), Edgecast (MP4 + FLV) and Limelight (only FLV).

Startparam

The querystring parameter that must be used to load video from an offset differs per module and CDN. Therefore, it can be set in the JW Player using the startparam configuration parameter. By setting this configuration option, you enable pseudo-streaming in Flash, using the parameter name you inserted.

Here is an example of a setup of JW Player, presenting an MP4 video. JW Player is setup to use the pseudo-streaming capabilities of the server. (In this case, EdgeCast):

 
<div id="myElement"></div>

<script>
    jwplayer("myElement").setup({
      image: "/uploads/myPoster.jpg",
      file: "/uploads/myVideo.mp4",
      startparam: "ec_seek"
    });
</script>

In our above code, you can see that we are utilizing Edgecast's ec_seek start parameter to enable pseudo-streaming in Flash. However, not all start parameters are the same. Below, we have an overview of different startparam values for different modules/CDNs:

Module/CDN startparam (MP4) startparam (FLV)
mod_h264 starttime start
mod_flvx - start
HttpFlvModule - start
HttpMp4Module start -
Bitgravity starttime apstart
Edgecast ec_seek ec_seek
Limelight ms fs
Nimble Streamer start start

 

Please sign in to leave your feedback for this article.

Still don't have JW Player? Get It Here