Flex操作網路攝影機

來源:互聯網
上載者:User

      Flex通過Camera類來操作網路攝影機。使用Camera類可以通過串連運行Adobe Flash Player的電腦的視頻網路攝影機捕獲視頻。

      Camera類通過getCamera()方法返回網路攝影機,在WSF訪問網路攝影機時,Flash Player會顯示一個對話方塊,使用者可以通過該對話方塊允許或拒絕對網路攝影機的訪問。

      簡單樣本:

 1:  <?xml version="1.0" encoding="utf-8"?>
 2:  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="InitCamera()">
 3:      <mx:Script>
 4:          <![CDATA[
 5:              import flash.events.*;
 6:              import flash.media.Camera;
 7:              import flash.media.Video;
 8:   
 9:              private var video:Video;
10:              public function InitCamera():void
11:              {
12:                  //擷取網路攝影機
13:                  var c:Camera=Camera.getCamera();
14:                  if(c != null)
15:                  {
16:                      c.addEventListener(ActivityEvent.ACTIVITY,activityHandler);
17:                      video=new Video(c.width*2,c.height*2);
18:                      video.attachCamera(c);
19:                      vdTest.addChild(video);
20:                  }
21:                  else
22:                  {
23:                      trace("請串連網路攝影機");
24:                  }
25:              }
26:   
27:              private function activityHandler(event:ActivityEvent):void{
28:                  trace("activityHandler: " + event);
29:              }
30:   
31:          ]]>
32:      </mx:Script>
33:      
34:      <mx:VideoDisplay id="vdTest" width="160" height="120"/>
35:  </mx:Application>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.