zoukankan      html  css  js  c++  java
  • 判断VideoDisplay组件当前的播放状态。播放|缓冲。

    stateChange="videoDisplay_stateChange(event);"

     

    <?xml version="1.0" encoding="utf-8"?>
    <!-- http://blog.flexexamples.com/2008/01/01/determining-a-videodisplay-controls-current-playback-state-using-the-state-property-and-statechange-event/ -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            layout
    ="horizontal"
            verticalAlign
    ="middle"
            backgroundColor
    ="white">

        
    <mx:Script>
            
    <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.events.VideoEvent;

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

                private const VIDEO_URL:String = "http://www.helpexamples.com/flash/video/water.flv";

                private function videoDisplay_stateChange(evt:VideoEvent):void {
                    /* videoDisplay.state == evt.state */
                    arrColl.addItem({label:videoDisplay.state});
                    progressBar.label = evt.state;
                }

                private function button_click(evt:MouseEvent):void {
                    /* Reset ArrayCollection object. */
                    arrColl = new ArrayCollection();
                    /* Set the Canvas container to visible. */
                    canvas.visible = true;
                    /* If video is currently playing, stop playback. */
                    if (videoDisplay.playing) {
                        videoDisplay.stop();
                    }
                    /* Set VideoDisplay control's source property and start
                       video playback. */
                    videoDisplay.source = VIDEO_URL;
                    videoDisplay.play();
                }

                private function videoDisplay_playheadUpdate(evt:VideoEvent):void {
                    progressBar.setProgress(evt.playheadTime, videoDisplay.totalTime);
                }
            
    ]]>
        
    </mx:Script>

        
    <mx:ApplicationControlBar dock="true">
            
    <mx:Button id="button"
                    label
    ="load movie"
                    click
    ="button_click(event);" />
        
    </mx:ApplicationControlBar>

        
    <mx:Canvas id="canvas" visible="false">
            
    <mx:VideoDisplay id="videoDisplay"
                    playheadUpdateInterval
    ="50"
                    stateChange
    ="videoDisplay_stateChange(event);"
                    playheadUpdate
    ="videoDisplay_playheadUpdate(event);" />

            
    <mx:ProgressBar id="progressBar"
                    label
    =""
                    labelPlacement
    ="center"
                    mode
    ="manual"
                    bottom
    ="0"
                    horizontalCenter
    ="0" />
        
    </mx:Canvas>

        
    <mx:List id="list"
                dataProvider
    ="{arrColl}"
                width
    ="100" />

    </mx:Application>

  • 相关阅读:
    CentOS 7 修改时区
    flink与kafka结合
    Kafka 原理和实战
    kafka单机多节点部署
    使用yumdownloadonly下载RPM包及依赖包
    使用Onvif协议进行设备发现以及指定设备信息探测
    kafka相关脚本操作
    Python入门篇-基础语法
    Python入门篇-pyenv安装及应用
    zabbix Server 4.0监控Flume关键参数
  • 原文地址:https://www.cnblogs.com/jiahuafu/p/1875817.html
Copyright © 2011-2022 走看看