Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

video player for AIR to play local files

4 replies [Last post]

Hi All,

I am developing an AIR application which can <b>play videos from local directory</b> as well as from server or Youtube. I am using JW Flash player for that.
I am able to play videos from server or Youtube, but when I give the path(relative to HTML page containing player). It gives an error: "Video not found: video.flv"
where video.flv is the video file that I am trying to play. And the video & HTML page are in the same directory.

<b>Please help me out in playing videos from local directory.</b>

Code Snippet is as follows:
<script type="text/javascript" src="swfobject.js"></script>
<script type='text/javascript' src='/embed/swfobject.js'></script>

<div id='preview'>This div will be replaced</div>

<script type='text/javascript'>
var s1 = new SWFObject('player.swf','ply','320','200','9','#ffffff');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('wmode','opaque');
s1.addParam('flashvars','file=video.flv');
s1.write('preview');
</script>

Please see the Tutorial linked at the top of this page titled Embedding Flash. The section titled Flashvars problems explains that the relative path for FLV video container files begins at the location of the movie.

can u give the code for playing swf files from server into my video player which i have made in flex builder3. And if user goes offline all these files should get stored into the SQLite database so that user could play these videos files even in offline mode.

Kindly help me...........

There is a bug in AIR that results in relative files in the application install directory getting a bad URL. To work around this problem you can supply an absolute URL.

Something like the following should work:
var file = air.File.applicationDirectory.resolvePath("video.flv");
var url = file.URL;

Where this code must be placed, be more specific and clear.
Iam having the same problem, i cant play local .flv files in a air compiled app.