Use Button to control VideoDisplay : VideoDisplay « Graphics « Flex






Use Button to control VideoDisplay

Use Button to control VideoDisplay
   

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        
            import mx.collections.ArrayCollection;
            import mx.events.CuePointEvent;
            import mx.events.VideoEvent;

            [Bindable]
            private var arrColl:ArrayCollection = new ArrayCollection()

            private function doVideoEvent(evt:VideoEvent):void {
                doAddItem({type:evt.type});
            }

            private function doCuePointEvent(evt:CuePointEvent):void {
                doAddItem({type:evt.type});
            }

            private function doProgressEvent(evt:ProgressEvent):void {
                doAddItem({type:evt.type});
            }

            private function doAddItem(obj:Object):void {
                arrColl.addItem({type:obj.type, state:videoDisplay.state, playheadTime:videoDisplay.playheadTime, totalTime:videoDisplay.totalTime});
                dataGrid.validateNow();
                dataGrid.selectedIndex = arrColl.length;
                dataGrid.scrollToIndex(arrColl.length);
            }
      
    </mx:Script>

    <mx:VideoDisplay id="videoDisplay" source="http://server.com/a.flv" 
            autoPlay="false" 
            autoRewind="false"
            ready="doVideoEvent(event);"
            rewind="doVideoEvent(event);"
            playheadUpdate="doVideoEvent(event);"
            close="doVideoEvent(event);"
            complete="doVideoEvent(event);"
            progress="doProgressEvent(event);" />

    <mx:HBox>
        <mx:Button label="play()" click="videoDisplay.play();" />
        <mx:Button label="pause()" click="videoDisplay.pause();" />
        <mx:Button label="stop()" click="videoDisplay.stop();" />
    </mx:HBox>

    <mx:DataGrid id="dataGrid" dataProvider="{arrColl}" width="320" rowCount="5">
        <mx:columns>
            <mx:DataGridColumn id="typeCol"         dataField="type" headerText="Evt. type" />
            <mx:DataGridColumn id="stateCol"        dataField="state" />
            <mx:DataGridColumn id="playheadTimeCol" dataField="playheadTime" textAlign="right" />
            <mx:DataGridColumn id="totalTimeCol"    dataField="totalTime" textAlign="right" />
        </mx:columns>
    </mx:DataGrid>

</mx:Application>

   
    
    
  








Related examples in the same category

1.Look up VideoDisplay's metadata cuePoints and compare to current cue point object
2.Listen for a Flash Video's cue points with VideoDisplayListen for a Flash Video's cue points with VideoDisplay
3.Ready, rewind, playheadUpdate, close, complete and progress actions for VideoDisplayReady, rewind, playheadUpdate, close, complete and progress actions for VideoDisplay
4.autoPlay, autoRewind for VideoDisplayautoPlay, autoRewind for VideoDisplay
5.Detect connection error when loading flv with VideoDisplayDetect connection error when loading flv with VideoDisplay
6.Detecting a connection error when loading an FLV with the VideoDisplay controlDetecting a connection error when loading an FLV with the VideoDisplay control
7.Use a VideoDisplay controlUse a VideoDisplay control
8.Set cue points for the VideoDisplay control by using the cuePointManager property.Set cue points for the VideoDisplay control by using the cuePointManager property.
9.Use VideoDisplay.attachCamera() method to display a video stream from a camera
10.Use VideoDisplay control to import a media stream from Macromedia Flash Media Server 2 from Adobe
11.A VideoDisplay control
12.When the playhead of the VideoDisplay control reaches a cue point, it dispatches a cuePoint event
13.VideoDisplay CuePoint Manager
14.VideoDisplay Camera
15.VideoDisplay FMSVideoDisplay FMS
16.Load video with Remote Data ProvidersLoad video with Remote Data Providers
17.Play video with VideoPlayPlay video with VideoPlay
18.Play video from a URLPlay video from a URL
19.Create a Video DisplayCreate a Video Display
20.Complete and mediaPlayerStateChange events dispatched by the VideoPlayer controlComplete and mediaPlayerStateChange events dispatched by the VideoPlayer control
21.Show the user of the DynamicStreamingVideoSource objectShow the user of the DynamicStreamingVideoSource object
22.Dispatch a cuePoint eventDispatch a cuePoint event
23.CuePointEvent DemoCuePointEvent Demo
24.Use the pause() and play() to pause or play an FLV fileUse the pause() and play() to pause or play an FLV file