1 Reply Latest reply on Sep 16, 2010 11:39 PM by Gurdeep Singh

    Vidioplayer cuepoint

    athiroy Level 1

      hi

      i am working in flash builder 4.

      i want play the video.

      i encode my .flv files many cuepoints.

      i use the following code to play the video file and captionining

      <?xml version="1.0" encoding="utf-8"?>
      <!-- http://blog.flexexamples.com/2007/08/12/dynamically-creating-actionscript-cue-points-from- flashvars-loaded-using-the-httpservice-tag/ -->
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                      layout="vertical"
                      verticalAlign="middle"
                      backgroundColor="white" horizontalAlign="center">
          <mx:Label width="89" id="l1"/>
          <mx:Panel width="250" height="200" layout="absolute" horizontalAlign="center" verticalAlign="middle">
              <mx:VideoDisplay id="videoDisplay"
                               autoPlay="true"
                               autoRewind="false"
                               cuePointManagerClass="mx.controls.videoClasses.CuePointManager"
                               cuePoint="videoDisplay_cuePoint(event)"
                               playheadUpdate="videoDisplay_playheadUpdate(event)"
                               progress="videoDisplay_progress(event)"
                               click="videoDisplay_click(event)"
                               rewind="arrColl=new ArrayCollection()"
                               rollOver="progressBar.visible = true"
                               rollOut="progressBar.visible = false"  width="244" height="184" x="-14" y="-24" source="assets/Final_namaste11.flv"/>
              <mx:Button label="Button" width="29" height="20" click="callvideo();" id="p" x="100.5" y="51"/>
          </mx:Panel>
          <mx:HBox width="247" verticalAlign="top" color="#00090B" themeColor="#030E16" borderStyle="solid" borderThickness="5">
              <mx:Button label="P" labelPlacement="left" click="videoplay(event);" width="37" height="20"/>
              <mx:Button label="P" labelPlacement="left" click="videopause(event);" width="37" height="20"/>
              <mx:Button label="A" labelPlacement="left" click="videoprevious(event);" width="37" height="20"/>
          </mx:HBox>
          <mx:HTTPService id="httpService"
                         
                          result="httpService_result(event)"
                          resultFormat="flashvars" />
         
          <mx:Script>
              <![CDATA[
                  import mx.collections.ArrayCollection;
                  import mx.controls.Alert;
                  import mx.events.CuePointEvent;
                  import mx.events.VideoEvent;
                  import mx.managers.SystemManager;
                  import mx.rpc.events.ResultEvent;
                  import mx.utils.ObjectUtil;
                  import mx.utils.URLUtil;
                 
                  [Bindable]
                  private var arrColl:ArrayCollection = new ArrayCollection();
                  private var a:String;
                  private function httpService_result(evt:ResultEvent):void {
                      var flashVars:Object = httpService.lastResult;
                     
                      var item:String;
                      for (item in flashVars) {
                          videoDisplay.cuePointManager.addCuePoint({name:item, time:flashVars[item]});
                      }
                  }
                 
                  private function videoDisplay_cuePoint(evt:CuePointEvent):void {
                      var cpDate:Date = new Date(evt.cuePointTime * 1000);
                  l1.text=dateFormatter.format(cpDate);
                  //l1.text=evt.cuePointTime;
                      arrColl.addItem({name:evt.cuePointName, time:evt.cuePointTime});
                       a=evt.cuePointName;
                      //Alert.show(a);
                       if(a=="name_2")
                       { 
                          
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                     
                           mytext.text="Indians greet each other with namaste. The two palms are placed together in front of the chest and the head bows whilst saying the word namaste. ";
                          
                       }
                       if(a=="name_3")
                       {
                           videoDisplay.pause();
                          /* play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                       if(a=="name_4")
                       {
                          
                          
                            mytext.text = "This greeting is for all -people younger than us, of our own age, those older and even strangers and us.";
                          
                       }
                       if(a=="name_5")
                       {
                           videoDisplay.pause();
                          /* play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                       if(a=="name_6")
                       {
                          
                           /*play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "There are five forms of formal traditional greeting of which namaskaram is one.";
                          
                       }
                       if(a=="name_7")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                      
                       if(a=="name_8")
                       {
                          
                          /* play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "This is understood as prostration but it actually refers to paying homage as we do today when we greet each other with a namaste.";
                          
                       }
                       if(a=="name_9")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                       if(a=="name_10")
                       {
                          
                           /*play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "Namaste could be just a casual or formal greeting, a cultural convention or an act of worship.";
                          
                       }
                       if(a=="name_11")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                      
                       if(a=="name_12")
                       {
                          
                           /*play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "But there is more to the word namaste than meets the eye.";
                      //     mytext1.text=t;
                       }
                       if(a=="name_13")
                       {
                           videoDisplay.pause();
                          /* play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                       if(a=="name_14")
                       {
                          
                          /* play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "In Sanskrit namaste means -I bow to you -my greetings, salutations or prostration to you.";
                         
                       }
                       if(a=="name_15")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                       if(a=="name_16")
                       {
                          
                          /* play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = " The real meeting between people is the meeting of their minds. When we greet another, we do so with namaste,";
                          
                       }
                       if(a=="name_17")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                      
                       if(a=="name_18")
                       {
                          
                          /* play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "which means, may our minds meet, indicated by the folded palms placed before the chest.";
                          
                       }
                       if(a=="name_19")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                      
                       if(a=="name_20")
                       {
                          
                           /*play_btn.visible=false;
                           pause_btn.visible=true;*/
                           mytext.text = "The bowing down of the head is a gracious form of extending friendship in love and humility.";
                         
                       }
                       if(a=="name_21")
                       {
                           videoDisplay.pause();
                           /*play_btn.visible=true;
                           pause_btn.visible=false;*/
                       }
                      
                       if(a=="name_22")
                       {
                          
                           //play_btn.visible=false;
                           //pause_btn.visible=true;
                           mytext.text = "When we know this significance, our greeting does not remain just a superficial gesture or word ";
                          
                       }
                       if(a=="name_23")
                       {
                           videoDisplay.pause();
                          
                       }
                      
                       if(a=="name_24")
                       {
                          
                           //play_btn.visible=false;
                           //pause_btn.visible=true;
                           mytext.text = "but paves the way for a deeper communion with another in an atmosphere of love and respect.";
                          
                       }
                       if(a=="name_25")
                       {
                           videoDisplay.pause();
                           //play_btn.visible=true;
                           //pause_btn.visible=false;
                       }
                      
                       if(a=="name_26")
                       {
                          
                      //     play_btn.visible=false;
                          // pause_btn.visible=true;
                           mytext.text = " When we know this significance,";
                          
                       }
                       if(a=="name_27")
                       {
                           videoDisplay.pause();
                           //play_btn.visible=true;
                           //pause_btn.visible=false;
                       }
                      
                       if(a=="name_28")
                       {
                          
                           //play_btn.visible=false;
                           //pause_btn.visible=true;
                           mytext.text = "our greeting does not remain just a superficial gesture or word";
                         
                       }
                       if(a=="name_29")
                       {
                           videoDisplay.pause();
                          // play_btn.visible=true;
                           //pause_btn.visible=false;
                       }
                       if(a=="name_30")
                       {
                          
                          // play_btn.visible=false;
                           //pause_btn.visible=true;
                           mytext.text = "but paves the way for a deeper communion with another in an atmosphere of love and respect. ";
                          
                       }
                       if(a=="name_31")
                       {
                           videoDisplay.pause();
                           //play_btn.visible=true;
                           //pause_btn.visible=false;
                       }
                  }
                  private function videoDisplay_playheadUpdate(evt:VideoEvent):void {
                      var pDate:Date = new Date(evt.playheadTime * 1000 || 10);
                      var tDate:Date = new Date(evt.currentTarget.totalTime * 1000);
                      progressBar.setProgress(evt.playheadTime, evt.currentTarget.totalTime);
                      progressBar.label = dateFormatter.format(pDate) + " / " + dateFormatter.format(tDate);
                  }
                 
                  private function videoDisplay_progress(evt:ProgressEvent):void {
                      progressBar.conversion = 1024; /* Convert bytes to kilobytes. */
                      progressBar.label = "%1 of %2 KB (%3%%)";
                      progressBar.setProgress(evt.bytesLoaded, evt.bytesTotal);
                  }
                 
                  private function videoDisplay_click(evt:MouseEvent):void {
                      //videoDisplay.play();
                  }
                  private function videoplay(evt:MouseEvent):void {
                      videoDisplay.play();
                  }
                  private function videopause(evt:MouseEvent):void {
                      videoDisplay.pause();
                  }
                 
                  private function videoprevious(evt:MouseEvent):void {
             
                  }    private function callvideo():void {
                          videoDisplay.play();
                                 
                     
                  }
              ]]>
          </mx:Script>
         
          <mx:DateFormatter id="dateFormatter" formatString="NN:SS" />
                 
                  <mx:ProgressBar id="progressBar"
                                  mouseChildren="false"
                                  labelPlacement="center"
                                  visible="false"
                                  mouseEnabled="false"
                                  mode="manual" left="5" right="5" bottom="5" />
                  <mx:Label width="509" height="46" id="mytext"/>
             
              <mx:DataGrid id="dataGrid"
                           height="100%"
                           dataProvider="{arrColl}" visible="false">
                  <mx:columns>
                      <mx:DataGridColumn dataField="name"
                                         headerText="CuePoint Name:" />
                      <mx:DataGridColumn dataField="time"
                                         headerText="CuePoint Time:" />
                  </mx:columns>
              </mx:DataGrid>
         
      </mx:Application>

      But it displays cuepoint time 00.08 only

      but i split cuepoints 00:08:500;

       

      pls help me to give any suggestions

      regards

      athi