What is HTTP Dynamic Streaming?

HTTP Dynamic Streaming FlowUntil now video content delivery over HTTP has been delivered in a progressive manner, meaning to view part of or seek to a specific location in the video you have to wait for that part to download. RTMP allows for the ability to seek to any point in the video content via streaming, but requires a server technology such as the Flash Media Server to do this. HTTP Dynamic Streaming or HDS combines HTTP (progressive download) and RTMP (streaming download) allow for the ability to deliver video content in a steaming manner over HTTP. This means:

  • A streaming server technology is not required
  • Clients can access and begin playing content ‘instantly’
  • Clients can seek to points in the video content that have not yet downloaded.

…and all the above over the HTTP protocol.

There are a of couple things that you’ll need to consider when getting started with HTTP Dynamic Streaming.

First, a media server to stream the content is not required, but the Apache Web server with the HTTP Origin Module installed is. The HTTP Origin Module is a free to use Apache module provided by Adobe, and comes pre-installed and configured with the Flash Media Server when you install the bundled web server. We’ll cover the installation, set up and data flow for the HTTP Origin Module in a subsequent post.

Second, the video content will need to be ‘prepared’ for HTTP Dynamic Streaming before being deployed to your server. This means the workflow for content creation will need to be adjusted to accommodate the packaging of your video content into the F4F file format. There is a tool, the f4fpackager, that Adobe has created to do this for you and we will discuss the details of this tools and how you can use it later as well.

F4Fragment ExtractorAt Realeyes, we’ve done some some work with AIR and the F4F file format spec to create the The F4Fragment Extractor.  The F4FragmentExtractor is a utility for extracting the F4V fragments from the F4F files created by Adobe’s file packager for HTTP streaming. This means that you can deploy the fragments produced by this tool  to any Web server or cloud services like Amazon S3 and reap the benefits of HDS even without the HTTP Origin Module.

In the next few articles, we’ll look at:

  • Getting Started with HDS
  • Use cases for HDS
  • Integrating HDS into your content creation workflow

Between now and when I get to the next post let me know if you have any questions or would like to see something specific about HTTP Dynamic Streaming in the comments.

OSMF 1.5 is in the Wild!

Open Source Media Framework (OSMF) is an open software framework for building robust, feature rich video players and applications based on the Adobe® Flash® Platform.

OSMF has two key objectives:

  1. Enable content providers to focus on the user experience, rather than player plumbing
  2. Enable ecosystem partners to focus delivering best-in-class services, instead of player integration

OSMF 1.5 has been released! Grab it here.

Adobe Camp: 1 Day, 3 Camps: 5280 Reasons to Use the Flash Platform

Rocky Mountain Adobe CampIf you haven’t heard already, the first Rocky Mountain Adobe Camp is open for registration.

The first ever, one of a kind, Rocky Mountain Adobe Camp is right here in Denver on June 22, 2009. Digital professionals at all experience levels are invited to this one-day event to participate in in-depth sessions, and unique hands-on activities taught by some of the most influential speakers in the “Flash-o-sphere”.

Want more information?
Check out http://camp.rmaug.com for event date and location as well as speaker and session info.

Use twitter?
Follow @adobecamp’s updates for more information and news.

There are some interesting sessions that will be divided between 3 different “tracks”:

  • Flash Camp: Get ready to learn best practices, discover hidden features, and extend your abilities
  • Dynamic Media Camp: Developers and content owners alike will expand their current knowledge of the Flash Media Server family
  • eLearning Camp: Trainers, staff development managers, and Human Resource professionals will all gain valuable insight for eLearning development using tools such as Adobe Connect, Adobe Captivate, and Adobe Acrobat

So pick one and register for the First Rocky Mountian Adobe Camp!

Adobe Announces the Open Screen Project

Adobe has just announced the Open Screen Project.

The Skinny:

  • Restrictions on use of the SWF and FLV/F4V specifications will be removed
  • The device porting layer APIs for Adobe Flash Player will be published
  • The Adobe Flash® Cast™ protocol and the AMF protocol for robust data services will be published
  • Licensing fees will be removed – making next major releases of Adobe Flash Player and Adobe AIR for devices free

What does it really mean? Well it could be the promise of a universal application platform and the ability to write an application and deploy it everywhere. But, we know, with the likes of Apple and Google, who haven’t really taken to the flash platform, that probably isn’t the case. To me it means that Adobe is allowing the community as a whole to participate in the direction that the flash platform takes. To develop what what the community wants and thinks needs to be developed. This is a good thing – yay Adobe and yay Flash!

A few more links to read:

Ryan Stewart

Techcrunch

Wired

Developers: http://www.adobe.com/openscreenproject/developers/

Businesses: http://www.adobe.com/openscreenproject/businesses/

Reading a file Asynchronously with ActionScript 3

Sometimes (okay, manytimes) files are large enough that the process of opening and reading its contents may take some time. To solve issues related to the extra time this may take AS3 allows you to open files asynchronously. I’d like to add to the information from the reading files with AS3 post. Here we’ll cover the code necessary to open a file asynchronously and read the file contents as they become available.

Because we are now doing something asynchronously, we will be dealing with events. As the file contents are being read The FileStream object broadcasts progress events that we can listen for and respond to. This ensures that when we are reading data when the data is available.

So, onto the code:
[as]
// Imports
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.filesystem.File;
import flash.events.ProgressEvent;
import flash.events.Event;

// Declare the FileStream and String variables
private var _fileStream:FileStream;
private var _fileContents:String;

private function onCreationComplete():void // Fired when the application has been created
{
var myFile:File = File.appResourceDirectory; // Create out file object and tell our File Object where to look for the file
myFile = myFile.resolve(“mySampleFile.txt”); // Point it to an actual file

_fileStream = new FileStream(); // Create our file stream

_fileStream.addEventListener(ProgressEvent.PROGRESS, onFileProgress); // Add our the progress event listener
_fileStream.addEventListener(Event.COMPLETE, onFileComplete); // Add our the complete event listener

_fileStream.openAsync(myFile, FileMode.READ); // Call the openAsync() method instead of open()
}

private function onFileProgress(p_evt:ProgressEvent):void // Event handler for the PROGRESS Event
{
_fileContents += _fileStream.readMultiByte(_fileStream.bytesAvailable, “iso-8859-1”); // Read the contens of the file and add to the contents variable

fileContents_txt.text = _fileContents; // Display the contents. I’ve created a TextArea on the stage for display
}

private function onFileComplete(p_evt:Event):void // Event handler for the COMPLETE event
{
_fileStream.close(); // Clean up and close the file stream
}
[/as]

As for what all that code does – first off, import the required classes:
[as]
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.filesystem.File;
import flash.events.ProgressEvent;
import flash.events.Event;
[/as]

Then we’ll need to create a couple variables. First, the FileStream which we’ll use to read our file and second, a String variable that we’ll use to display the file contents.
[as]
private var _fileStream:FileStream;
private var _fileContents:String;
[/as]

Now we’ll create an onCreationComplete() method. This method will handle the creationComplete event of the application to get things rolling. Inside the onCreationComplete() method we’ll need to create out File object as well as the FileStream object.
[as]
private function onCreationComplete():void // Fired when the application has been created
{
var myFile:File = File.appResourceDirectory;
myFile = myFile.resolve(“mySampleFile.txt”);

_fileStream = new FileStream();
}
[/as]

Still in the onCreationComplete() method, we’ll need to handle those events that will be dispatched while reading the file asynchronously. The events that we will handle are:

  • ProgressEvent.PROGRESS – This will fire as the bytes are read from the file into the buffer.
  • Event.COMPLETE – This will fire when all the bytes of the file have been read into the buffer.

[as]
private function onCreationComplete():void // Fired when the application has been created
{
var myFile:File = File.appResourceDirectory;
myFile = myFile.resolve(“mySampleFile.txt”);

_fileStream = new FileStream();

_fileStream.addEventListener(ProgressEvent.PROGRESS, onFileProgress)
_fileStream.addEventListener(Event.COMPLETE, onFileComplete);
}
[/as]

The final part of the onCreationComplete() method is to open the file asynchronously. Add the following line to the end of the method:
[as]
_fileStream.openAsync(myFile, FileMode.READ);
[/as]

Now to handle those events and read our file. First, we’ll deal with the PROGRESS event. Inside the onFileProgress() event handler method, we read the availableBytes from the file and add it to our String variable. Notice the second parameter of the readMultiByte() method – "iso-859-1". This specifies the content type of the file that we are reading. I’ll cover some of the other content types in a later post. So, keep an eye out for that one if you’re curious. Finally, we update the TextArea, to show we are actually reading the file.
[as]
private function onFileProgress(p_evt:ProgressEvent):void
{
_fileContents += _fileStream.readMultiByte(_fileStream.bytesAvailable, “iso-8859-1”);

fileContents_txt.text = _fileContents;
}
[/as]

We still need to clean up after ourselves, so in the onFileComplete() method, we’ll need to close out FileStream object.
[as]
private function onFileComplete(p_evt:Event):void
{
_fileStream.close();
}
[/as]

A very simple example, and it is still only text that we are reading. Next time I’d like to cover how to read different file types. So, like I said, keep an eye our for that post.