ASP.NET - How to embed my flv video file in my asp.net page

Asked By Caleb 05 on 21-Oct-09 09:13 AM
Hello Frnd's,

Can anyone help me how to embed a flv file in my website which is in folder.Im using jw player to play videos using swobject.js here is my code 

<script type='text/javascript'>var s1 = new SWFObject('player.swf','ply','420px','320px','0','#FFFFFF');s1.addParam('allowfullscreen','true');s1.addParam('wmode', 'transparent','true');s1.addParam('flashvars','file=Uploaded/Music/f17643d4-4ee9-43ad-919a-a21b8b74d2fc.flv');s1.write('container');</script>

I want to embed this and share with other sites and play them in other website player.....Awating for ur reply Experts...

Tks in Adv...

Caleb05.....

reply

Deepak Sonawane replied to Caleb 05 on 21-Oct-09 09:20 AM
Hi,
Using of JW FLV Player on web page

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" />
</embed>
</object>

 

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');
s1.addParam('allowfullscreen','true');
s1.addParam('allowscriptaccess','always');
s1.addParam('flashvars','file=video.flv');
s1.write('preview');
</script>

 

As you can see, nothing complicated here. Code creates SWFObject dynamically and then set its parameters. In this case visitor is not required to click to start a movie. Of course, JavaScript must be enabled in visitor's web browser.

Re

Ravenet Rasaiyah replied to Caleb 05 on 21-Oct-09 10:22 PM
Dex replied to Deepak Sonawane on 14-Jun-10 06:42 PM
For Deepak Sonawane

Deepak wrote:
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.

My problem or issue is I have the JW Player player Object/Embed code pasted into an itemtemplate within a data list. Well, let me tell my whole story. I have the flv files stored locally in the inetpub/www root folder. I have a referene to the video stored in a database table. I am displaying the video based on search criteria a user submitted. Now....My problem or issue is I have the JW Player player Object/Embed code pasted into an itemtemplate within a data list. This plays perfectly in Internet Explorer. The t-sql should bring back 4 recors with video and it does. However, the video will not play in Google Chrome, Safari nor Firefox. After reading the post from Deeoak regarding the object and embed tags I understand why the video won't play. My question is can this be coded in a manner to make the video play in Internet Explorer as it does and also in the other browsers? I read that it is better to use the SWFobject with java script to get cross browser compatibility. So, I created the code using the SWFobject code and again pasted it into the itemtemplate. The falsh now plays in all browsers but only one flv video displays now instead of the 4 with the object/embed method. My preference would be to get the object/embed code working or modified to work in the other browsers I listed. but if that's not possible what am I doing wrong to prevent the 3 other videos from displaying using the SWFobject/Javascript code. My code listing is below for the SWFObject but again. if the code can be slightly modified to make the object/embed work across browsers that would be better. Any help you can provide is greatly appreciated.

<asp:DataList ID="DataList1" runat="server" DataKeyField="eid" DataSourceID="SqlDataSource1">
 
eid:<ItemTemplate> <asp:Label ID="eidLabel" runat="server" Text='<%# Eval("eid") %>' />
<br />
addtofavorite:
<asp:Label ID="addtofavoriteLabel" runat="server" Text='<%# Eval("addtofavorite") %>' />
<br />
ddshareworkout:
<asp:Label ID="ddshareworkoutLabel" runat="server" Text='<%# Eval("ddshareworkout") %>' /> <br />
ddnewworkout:
<asp:Label ID="ddnewworkoutLabel" runat="server" Text='<%# Eval("ddnewworkout") %>' />
 <br />
demolink:
<asp:Label ID="demolinkLabel" runat="server" Text='<%# Eval("demolink") %>' />
 <br />
 <script src="swfobject.js" type="text/javascript">
</script>
 <div ID="mediaspace">
This text will be replaced
</div>
<script type="text/javascript">
so.addParam(

so.addParam(

so.addParam(

so.addVariable(

so.write(


var so = new SWFObject('player.swf', 'mpl', '320', '240', '9');'allowfullscreen', 'true');'allowscriptaccess', 'always');'wmode', 'opaque');'file', '<%# Eval("demolink") %>'); 'mediaspace');</script>