topical media & game development

talk show tell print

mashup-rmx-10-VideoPlayer-VideoPlayer.mx

mashup-rmx-10-VideoPlayer-VideoPlayer.mx (swf ) [ flash ] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application 
    creationComplete="init()"
    width="600" height="600"
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    layout="absolute">
    
  

script(s)


    <mx:Script source="mashup-rmx-10-VideoPlayer-videoPlayer.ax"/>
  

panel


    
    <mx:Panel 
            title="Video Player" 
            top="10" bottom="10" left="10" right="10" 
            layout="vertical" verticalGap="0">
    
      <mx:VideoDisplay 
              id="myVideoDisplay"
                  progress="this.downloadProgress.setProgress(event.bytesLoaded, event.bytesTotal); this.videoFileTotalBytes = event.bytesTotal;"
                  maintainAspectRatio="false" 
                  width="100%" height="100%"
                  volume="{this.volumeSlider.value}" 
                  autoPlay="true"/>
  

progress / download bar(s)


      
      <mx:Canvas width="100%">
              <mx:ProgressBar
                      id="downloadProgress" 
                      width="100%" height="10" trackHeight="10"
                      label="" mode="manual"
                      minimum="0" maximum="100"/>
              <mx:HSlider
                      id="playbackProgress"
                      trackSkin="@Embed(source='mashup-rmx-10-VideoPlayer-images-inv.png')"
                      change="if (event.clickTarget=='track') { this.myVideoDisplay.playheadTime = event.value; }"
                      thumbPress="if(myVideoDisplay.playing){this.myVideoDisplay.pause();}" 
                      thumbDrag="this.seekTo=this.playbackProgress.value" 
                      thumbRelease="this.myVideoDisplay.playheadTime = this.seekTo; this.myVideoDisplay.play();"
                      liveDragging="true"
                      width="{(this.downloadProgress.value/this.videoFileTotalBytes)*this.downloadProgress.width}"
                      height="10"
                      minimum="0"
                      maximum="{this.myVideoDisplay.totalTime * (this.downloadProgress.value/this.videoFileTotalBytes)}"
                      value="{this.myVideoDisplay.playheadTime}"/>
      </mx:Canvas>
  

control(s)


      
      <mx:ControlBar>
        <mx:HBox width="100%">
          <mx:Button label="Pause/Play" id="btn_playToggle"/>
          <mx:Button label="Stop" id="btn_stop"/>
          <mx:Spacer width="100%"/>
          <mx:Button id="btn_previous" label="Prev"/>
          <mx:Button id="btn_next" label="Next"/>
          <mx:Spacer width="100%"/>
          <mx:Label id="tf_playtimeDisplay"/>
          <mx:VSlider 
                  id="volumeSlider" 
                  liveDragging="true" 
                  value=".75" minimum="0" maximum="1" 
                  height="34"/>
        </mx:HBox>
      </mx:ControlBar>
      
    </mx:Panel>
    
  </mx:Application>
  
  


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.