Flex – Play video from local files from local files using Adobe Air

I want to play videos, and use adobe air to display images and possibly other flash content, and read from the local file system. I have been looking for APIs, and I have not been able to connect to the point.

I know flash.filesystem.File and flash.filesystem.FileStream and have tried loading and reading files. I believe I can load images this way, but haven’t tried it yet.

As for the video:

mx.controls.VideoDisplay when
– seems to have accepted a file: // URI source, but I can’t get it to work.

< p>flash.media.Video
-Accepts NetStream or can load video directly from the video input, it seems that I can’t find a way to reference local files

Can someone help me get out of here? I especially want to load and play videos directly from the local disk, not from a web server or streaming file server… assuming there is no network connection.

Slightly related question: Loading a video from the local file system…( But my question does not involve the web browser)

The purpose I think of needs to be used in the program. I’m looking for a way to do this directly using ActionScript.

I finally stumbled upon the solution I was hoping for… Use a NetStream object, but (non-intuitively) you can also use it To access local files:

private function playVideo():void {
var nc:NetConnection = new NetConnection();
nc.connect(null );

var ns:NetStream = new NetStream(nc);

# onMetaData listener is required otherwise you get a ReferenceError
var client:Object = new Object ();
client.onMetaData = function(metadata:Object):void {
trace(metadata.duration);
}
ns.client = client;

var v:Video = new Video();
v.attachNetStream(ns);
stage.addChild(v);

var f:File = new File("/tmp/test.flv");
ns.play(f.url);
}

I want to play a video, And use adobe air to display images and possibly other flash content, and read from the local file system. I have been looking for API , I have not been able to connect the dots.

I know flash.filesystem.File and flash.filesystem.FileStream and have tried to load and read files. I believe I can load in this way Image, but haven’t tried it yet.

As for the video:

mx.controls.VideoDisplay when
– it seems to accept a file: // URI source, but I can’t get It works.

flash.media.Video
– Accepts NetStream or can load video directly from the video input, it seems I can’t find a way to reference local files

Can someone help me from Are you going out here? I especially want to load and play videos directly from the local disk, not from a web server or streaming file server… assuming there is no network connection.

Slightly related question: Loading a video from the local file system…( But my question does not involve the web browser)

The purpose I think of needs to be used in the program. I am looking for a way to perform this operation directly using ActionScript Method.

I finally stumbled upon the solution I hoped for… Use the NetStream object, but (non-intuitively) you can also use it to access local files:

private function playVideo():void {
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns :NetStream = new NetStream(nc);

# onMetaData listener is required otherwise you get a ReferenceError
var client:Object = new Object();
client.onMetaData = function (metadata:Object):void {
trace(metadata.duration);
}
ns.client = client;

var v:Video = new Video( );
v.attachNetStream(ns);
stage.addChild(v);

var f:File = new File("/tmp/test.flv");
ns.play(f.url);
}

Leave a Comment

Your email address will not be published.