0 Replies Latest reply on Jul 25, 2011 3:10 PM by Devprq

    Flex - loading different videos problem

    Devprq

      Hi all, I'm using Flex Video Player component from Flash Builder 4.5 for a Video System. At this time everything is on a localhost at this time. I use the following javascript function the call the FlexPlayer.swf and create the HTML for the player:

       

      function createPlayer(videoSource){

          document.writeln("<div id=\"player\">");
          document
      .writeln("<object width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
          document
      .writeln("<param name=\"player\" value=\"bin-debug/FlexPlayer.swf\">");
          document
      .writeln("<embed src=\"bin-debug/FlexPlayer.swf\" name=\"player\" width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
          document
      .writeln("</embed>");
          document
      .writeln("</object>");
          document
      .writeln("</div>");              
      }

      The PHP variable which contains the source of the FLV video is $fileName. Then the parameter passing to Javascript is:

       

      <script type="text/javascript">
      var videoSource = "<?php echo $fileName; ?>";
          createPlayer
      (videoSource);
      </script>

      The problem lies in the FlexPlayer.mxml file where I need parameter for the video source

       

      <s:VideoPlayer id="Player" left="0" top="0" width="497" height="414"
                            
      skinClass="MySkin" source="FlashVars"/>
         
      </s:Group>

      FlashVars contains the video source as you can see from the code above but for some reason I can't watch different videos in the player. Any help will be greatly appreciated.