topical media & game development
script(s)
<
mx:Script
> <![CDATA[
adapted from
RMX VideoPlayer
public var playlisturl:String = "
sample-flex-video-playlist.xml
";
// public var playlisturl:String = "
mashup-rmx-10-VideoPlayer-playlist.xml
";
// see also
mashup-rmx-10-VideoBitmapDisplay.ax
]]>
</mx
:
Script
> <
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">
video display
<
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"/>
slider(s)
<
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>
the end
</mx
:Panel>
</mx
:Application>