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.
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.
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).
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 setup block, using the starttime value the H264 streaming module defaults to:
jwplayer("myElement").setup({
file: "/uploads/example.mp4",
height: 360,
image: "/uploads/example.jpg",
startparam: "starttime",
width: 640
});
And here is an overview of the startparam values for the modules and CDNs we listed above:
| 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 | - | fs |
Our pseudo-streaming example is using Edgecast's ec_seek startparam to enable pseudo-streaming in Flash.