0 Replies Latest reply on Aug 17, 2009 2:55 PM by rckehoe

    Question about FLV video and Flex

    rckehoe


      I have a flex app that gets a FLV video from my database, and then plays the first 500ms of it and pauses the video. I do this because, I want to have a still image of the video until you roll-over the image with your mouse (which plays the video)

       

      On my website, I display about 15-20 of these apps at one time... Now, most of the videos do like they should, but some just have a black screen until you click roll-over the image, then it plays the right video just as it should.

       

      It is just that initial play, it doens't want to initially play ALL videos, it only play some of them.

       

      I don't know if is because I have a bunch of these flash objects on the page, or maybe it's my actionscript or maybe it is a browser issue... I do not know. Perhaps someone could shed some light.

       

      Here is my flex code if it helps:

      I am using a javascript.write function to write the objects to get around IE's pesky "Click here to active... blah blah"

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application creationComplete="init();" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="90%" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#000000, #000000]">

          <mx:Script>
              <![CDATA[
             
                  import mx.events.VideoEvent;
                  import mx.core.Application;
                 
                  [Bindable] private var VideoSource:String;
                  [Bindable] private var ProdID:String;
                 
                  private function init():void {
                     
                      vtxt.visible=true;
                      vtxt.text = 'loading video...';
                     
                      VideoSource = Application.application.parameters.FLVUrl;
                      ProdID = Application.application.parameters.ProdId;
                     
                      vd.volume=0;
                      vd.play();
                      vd.addEventListener(VideoEvent.READY,showFirst);
                     
                  }
                 
                  private function showFirst(evt:Event):void {
                     
                      setTimeout(ControlVideo, 500);
                     
                  }
                 
                  private function ControlVideo(VControl:String = "stop"):void{
                     
                      vtxt.visible=false;
                      if(VControl=='play'){ vd.play(); }
                      else{ vd.pause(); }
                     
                  }
                 
                  private function OpenProductURL():void {
                     
                      var u:URLRequest = new URLRequest("/productview.php?product_id="+ProdID);
                      navigateToURL(u,"_Parent");
                     
                  }
                 
              ]]>
          </mx:Script>

          <mx:VideoDisplay id='vd' source="{VideoSource}" autoPlay="false" resize="true" left="0" right="0" top="0" bottom="0" borderStyle="solid" borderThickness="1" borderColor="#000000" autoRewind="true"/>
          <mx:Label horizontalCenter="0" verticalCenter="0" color="#FFFFFF" id="vtxt" text="..."/>
          <mx:Canvas left="0" right="0" top="0" bottom="0" click="OpenProductURL();" mouseOver="ControlVideo('play');" mouseOut="ControlVideo('stop');">
          </mx:Canvas>
         
      </mx:Application>