Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends,

I download the jw player. i want to know how to give the video url at the run time for the java script given by jw player. if anyone know the solution help me.

Here is the code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head  runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1"  runat="server">

    <div>  

      <div id="mediaplayer">JW Player goes here</div>

      <script type="text/javascript" src="jwplayer.js"></script>

      <script type="text/javascript">

            jwplayer("mediaplayer").setup({

                  flashplayer: "player.swf",

                  file: "sample.flv",

                  image: "preview.jpg"

            });

    </script>
</div>
    </form>
</body>
</html> 


Here the "sample.flv" is the video url i want to give the url at the runtime.

thanks,
Posted
Updated 4-May-11 3:58am
v3
Comments
Monjurul Habib 4-May-11 9:59am    
edited:code block.

1 solution

Try the following:

XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head  runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1"  runat="server">

    <div>

      <div id="mediaplayer">JW Player goes here</div>

      <script type="text/javascript" src="jwplayer.js"></script>

      <script type="text/javascript">

         function playSelected(fileURL)
         {
            jwplayer("mediaplayer").setup({

                  flashplayer: "player.swf",

                  file: fileURL,

                  image: "preview.jpg"

            });
         }
    </script>
</div>
    </form>
</body>
</html>


Now call the function at the time you want to play a file. Just pass the url to the function and it will do the trick.

Hope this will help you out.
 
Share this answer
 
Comments
sathya.spidy 11-May-11 7:03am    
thanks for your answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900