title: Passing source parameter to Flash player from Java application
body: <p>I looked through similar questions, but they did not help.. 
  I am creating a flash player to use in a Java Vaadin application (according to this blog <a href="http://www.derekentringer.com/blog/flex-3-simple-flv-player-scrubbing-pause-play/" rel="nofollow">http://www.derekentringer.com/blog/flex-3-simple-flv-player-scrubbing-pause-play/</a>), the code is below. I compile the project to get test.swf file and use it in a Java application. </p>
  
  <p>The player works fine if I place the source link directly into mxml file, inside the "VideoDisplay" tag (<code>source="rtmp://cp114761.live.edgefcs.net:443/live/tpc-live_1@44263" /&gt;</code> as in the blog) and then compile an use the resulting test.swf. </p>
  
  <p>But it does not play the video if I pass the "source" as a parameter from the java application. For that I compile the player without the "source" parameter inside "VideoDisplay" tag. In this case it only shows the buttons (so the player itself is loaded fine), but the video is not playing.</p>
  
  <p>Would be very grateful for any advice..</p>
  
  <p>Java code:</p>
  
  <pre><code>private Embedded video = new Embedded();
  video.setParameter("wmode", "opaque");
  video.setParameter("pluginspage","http://www.macromedia.com/go/getflashplayer");
  video.setParameter("type", "application/x-shockwave-flash");
  video.setParameter("allowfullscreen", "true");
  video.setParameter("allowScriptAccess", "always");
  video.setParameter("name","flvp2");
  video.setParameter("quality", "high");
  video.setParameter("sameDomain", "allowscriptaccess");
  video.setSource("path/to/resources/flash/test.swf");
  video.setParameter("flashVars", "source=rtmp://cp114761.live.edgefcs.net:443/live/tpc-live_1@44263");
  </code></pre>
  
  <p>Flash code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" backgroundColor="white" viewSourceURL="srcview/index.html"&gt;
      &lt;mx:Script&gt;
          &lt;![CDATA[
          private function formatTime(item:Date):String {
              return dateFormatter.format(item);
          }
          private function videoDisplay_playheadUpdate():void {
              var pT:Number = videoDisplay.playheadTime || 0.1;
              var tT:Number = videoDisplay.totalTime;
              var pTimeMS:Date = new Date(pT * 1000);
              var tTimeMS:Date = new Date(tT * 1000);
              timeLabel.text = formatTime(pTimeMS) + " / " + formatTime(tTimeMS);
          }
          private function slider_thumbPress():void {
              videoDisplay.pause();
          }
          private function slider_thumbRelease():void {
              videoDisplay.play();
          }
          private function videoDisplay_ready():void {
              videoDisplay.visible = true;
              controlBar.visible = true;
          }
          ]]&gt;
      &lt;/mx:Script&gt;
      &lt;mx:DateFormatter id="dateFormatter" formatString="NN:SS" /&gt;
      &lt;mx:Panel title="{videoDisplay.source.split('/').pop()} ({videoDisplay.state})"&gt;
          &lt;mx:VideoDisplay id="videoDisplay" visible="false" width="100%" height="100%"
                           playheadUpdate="videoDisplay_playheadUpdate()"
                           ready="videoDisplay_ready()"
                           rewind="videoDisplay.play()"
                           autoPlay="true"
                           live="true"
                           idleTimeout="1000" /&gt;
          &lt;mx:ControlBar id="controlBar" visible="false"&gt;
              &lt;mx:Button id="play" name="play" label="Play" click="videoDisplay.play()"&gt;&lt;/mx:Button&gt;
              &lt;mx:Button id="pause" name="pause" label="Pause" click="videoDisplay.pause()"&gt;&lt;/mx:Button&gt;
              &lt;mx:Label id="timeLabel" textAlign="right" /&gt;
          &lt;/mx:ControlBar&gt;
      &lt;/mx:Panel&gt;
  &lt;/mx:Application&gt;
  </code></pre>