views:

135

answers:

2

Hi All: PHP + java script code + flv player: I am trying to play a .flv video on a web page and i have the file name to play from mysql data base so i need to use php. In the code below there is a script that runs a video player (favideo from Adobe) this video player work fine when the web page have the .html extension and it wont work with .php one , and that resulting my php code not work .`` plz help thanks in advance here is the code :

    <HTML>
<head>
<title> PropertyVideo
</title>
    <script src="AC_RunActiveContent.js" type="text/javascript"></script>
    <script src="FAVideo.js" type="text/javascript"></script>
</head>
<body onLoad="">
<?php
    include '../Header.php';
    require '../../DataLayer/property_video.php';
    //$id=$_GET['pro_id'];
    $id=1;
    $vid=new property_video();
    $vids=$vid->GetRecords("property_id=".$id);
    $vid=$vids[0];
    $path = $vid->path;
?>
<div id="divOne"></div>
    <script type="text/javascript">
     playerOne = new FAVideo("divOne", <?PHP echo $path ?>,0,0,{ autoLoad:true, autoPlay:true });
    </script>
    <script>
        playerOne.addEventListener("playheadUpdate",this,myHandler);

        playerOne.removeEventListener("playheadUpdate",this,myHandler);

        function myHandler() 
     {
         //alert("eh");
        }
    </script>

<?php
    include 'footer.php';
?>
</body>
</HTML>

and the actual generated html code is:

<HTML>

PropertyVideo WelCome6 playerOne = new FAVideo("divOne", demo_video.flv,0,0,{ autoLoad:true, autoPlay:true });

<script>
    playerOne.addEventListener("playheadUpdate",this,myHandler);

    playerOne.removeEventListener("playheadUpdate",this,myHandler);

    function myHandler() 
 {
     //alert("eh");
    }
</script>

+1  A: 

You have some JavaScript that works.

You have some PHP that generates some JavaScript that doesn't work.

Therefore, the JavaScript you are generating doesn't match the JavaScript you know works.

Throwing some PHP down and saying "This doesn't work" is not a good approach to solving the problem.

You should be comparing the output of the PHP with the JavaScript that you know works.

(I'd guess it probably has something to do with missing quote marks around a JS string)

David Dorward
A: 

There might be more errors, but you certainly need to add some quotes to the path:

playerOne = new FAVideo("divOne", "<?PHP echo $path ?>",0,0,{ autoLoad:true, autoPlay:true });

Kristian J.
that worked thanks man
3bd