ASP.NET - Play a flv using with c# - Asked By Caleb 05 on 21-Sep-09 06:40 AM

Hi frnd's..

can anyone aid me how to play a  flv file using with c#.Im having no of flv files in a folder i want to play these files by passing their file name.Awaiting for ur reply experts..

Tks in Adv...


Play a flv using - Sagar P replied to Caleb 05 on 21-Sep-09 06:49 AM

First off all add the FlashControl.dll and use this function s follows:

public string mediaPath1(object sURL)
string str = ("UploadFile/flvplayer.swf?file=video1.flv&image=UploadFile/pics/ThumbnailImg1.jpg");

return ResolveUrl("UploadFile/flvplayer.swf?file=video1.flv&image=UploadFile/pics/ThumbnailImg1.jpg");

and use this method on the .aspx page like this

<object style="z-index: 1; position: relative" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=",0,0,0"

id="Object1" align="middle" height="160" width="190" class="alloutlineborder">

<param name="movie" value="<%#mediaPath1(Container.DataItem) %>">
<param name="quality" value="high">
<param name="bgcolor" value="#ffffff">
<param name="wmode" value="transparent" />

<embed wmode="transparent" src="<%#mediaPath1(Container.DataItem) %>" quality="high" bgcolor="white" name="lecteur" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="" align="middle" height="160" width="190" />


Also go thr these links for more help;

you can use tab in HTML - Venkat K replied to Caleb 05 on 21-Sep-09 07:25 AM

HTML Code ::

<object type="application/x-shockwave-flash" width="400" height="350"
wmode="transparent" data="flvplayer.swf?file=**vid location**&autoStart=true">
<param name="movie" value="flvplayer.swf?file=**vid location**&autoStart=true" />
<param name="wmode" value="transparent" />

Solution 2 ::

You can try the following  JW FLV Media Player, it's an open source FLV player written in Flash.


Reply - Deepak Sonawane replied to Caleb 05 on 21-Sep-09 07:25 AM


Do following things:

1. Open IIS Manager on the server
2. Expand the Local Computer Server.
3. Examine the 'Properties' of the local server
4. Select the MIME Types tab.
5. Click the 'New' button and enter the following:
* Associated Extension box: .FLV
* MIME Type box: flv-application/octet-stream
6. Click Ok and restart IIS.

Use this code:

There are a two basic steps when placing Flash application to web page:

- First, declare and initiate a Flash object

- Second, set properties of object according to your needs.

You can do this on two different ways, with static HTML tags <OBJECT > and <EMBED>, or by using a JavaScript. With static HTML your code could look something like this:

<object width="640" height="480">
<param name="movie" value="player.swf" />
<embed src="player.swf" width="640" height="480" />

We need both <object > and <embed > tags to get browser compatibility. Internet Explorer uses <object> tag, but Firefox and Netscape can't see it and recognize just <embed>. We set parameters by using <param > tags, and inside <embed > tag. Code example above have added parameter name "movie" and value "player.swf". You can add any other parameter on the same way. Complete list of supported parameters for JW FLV Player you can see at their Flash vars page.

There is a problem with static HTML if visitors access with Internet Explorer. Flash application would not start until visitor clicks on it. If you just place a cursor over a movie you'll see an ugly border. Common way to avoid need to click every time when page load is to initiate Flash player with JavaScript. JavaScript code for starting Flash movie could look like this:

<p id='preview'>The player will show in this paragraph</p>
<script type='text/javascript' src='swfobject.js'></script>
<script type='text/javascript'>
var s1 = new SWFObject('player.swf','player','400','300','9');


Error in SWFObject - Caleb 05 replied to Venkat K on 21-Sep-09 08:30 AM
Hello frnd...

Now Im using  JW FLV Media Player,its working fine.Im have folder named as FLVVideos inside that im having a flv files when i play first file name as 1.flv its playing but when i play anothe file 18.flv its showing an error as like this in that player

Kindly reply me...Awaiting for ur reply Experts....

Tks in Adv...

RE - Ravenet Rasaiyah replied to Caleb 05 on 21-Sep-09 09:21 AM

It's path issues, you need give the file path like this way

thank you