Adobe Air & Flex/Air개발

Air에서 동영상 메타데이터와 큐포인트 체크

꿈꾸는새벽별 2010. 4. 17. 13:10

 

air에서 또는 Flex에서 동영상 메타데이터와 큐포인트 체크 방법

Flash Builder에서 동영상을 보여주는데 꼭 체크해야 하는 부분을 놓친다..

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark"

                     xmlns:mx="library://ns.adobe.com/flex/mx"

                     creationComplete="init();">

    <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

    </fx:Declarations>

    <fx:Script>

        <![CDATA[

            private function init():void

            {

                var vid:Video = new Video();

                vv.addChild(vid);

                

                var nc:NetConnection = new NetConnection();

                nc.connect(null);

                

                var ns:NetStream = new NetStream(nc);

                

                var m:Object = new Object();

                

                //메타데이터 체크방법

                m.onMetaData=onMetaData;

                

                //큐포인트 체크방법

                m.onCuePoint = onCuePoint;

                ns.client = m;

                

                vid.attachNetStream(ns);

                

                

                ns.addEventListener(NetStatusEvent.NET_STATUS, okListener);    

                ns.addEventListener(IOErrorEvent.IO_ERROR , error);

                

                

                ns.play("http://www.helpexamples.com/flash/video/cuepoints.flv");

                //ns.play("yun.flv");

            }

            

            private function okListener(e:NetStatusEvent):void

            {

                

            }

            

            private function error(e:IOErrorEvent):void

            {

                

            }

            private function onMetaData(m:Object):void

            {

                var key:String;

                for (key in m)

                {

                    trace(key + ": " + m[key]);

                    trace("체크1");

                }

            }

            private function onCuePoint(m:Object):void

            {

                var key:String;

                for (key in m)

                {

                    trace(key + ": " + m[key]);

                    trace("체크2");

                }

            }

        ]]>

    </fx:Script>

    <s:VideoDisplay id="vv" />

</s:WindowedApplication>

 

Air 의 View 부분에 VideoDisplay 컴포넌트를 삽입후 id를 vv 로 입력후

위 스크립트 처리부분에서 vv.addChild 시킨다…

그래야 비디오가 보인다…

 

메타데이터와 큐포인트 체크를 위한 object를 선언후 onMetaData와 onCuePoint 함수 처리 부분도 유심히 보자..