• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            twzheng's cppblog

            『站在風口浪尖緊握住鼠標旋轉!』 http://www.cnblogs.com/twzheng

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              136 隨筆 :: 78 文章 :: 353 評論 :: 0 Trackbacks
            在FMS安裝目錄下的appliaction目錄下建立test1文件夾...

            然后打開flash 8插入以下代碼...
              1 function Record()
              2 {
              3     video_r._visible = true;
              4     video_p._visible = false;
              5     play_bt.enabled = false;
              6     record_bt.label = "停止";
              7     rapStatus = "recording";
              8     videoinfo.text = "文件信息:" + videoName + ".flv";
              9     rap_status.text = "當前狀態:正在錄制";
             10     netStream.publish(videoName, "record");
             11     RecordInterval = setInterval(RecordTime, 1000);
             12 
             13 function RecordStop()
             14 {
             15     rap_status.text = "當前狀態:錄制完成";
             16     record_bt.label = "錄制";
             17     play_bt.enabled = true;
             18     clearInterval(RecordInterval);
             19     timeNum = 0;
             20     netStream.close();
             21     rapStatus = "recordstop";
             22     videolist.addItem({label: videoName});
             23 
             24 function RecordTime()
             25 {
             26     ++timeNum;
             27     rap_status.text = "當前狀態:錄制中 - " + Math.floor(timeNum / 60+ "" + timeNum % 60 + "";
             28 
             29 function PlayVideo()
             30 {
             31     video_r._visible = false;
             32     video_p._visible = true;
             33     record_bt.enabled = false;
             34     play_bt.label = "停止";
             35     var playvideo = videolist.selectedItem.label;
             36     video_p.attachVideo(netStream);
             37     rapStatus = "playing";
             38     netStream.play(playvideo);
             39     netStream.onStatus = function (PlayInfo)
             40     {
             41         if (PlayInfo.code == "NetStream.Play.Stop")
             42         {
             43             rapStatus = "playstop";
             44             netStream.close();
             45             rap_status.text = "當前狀態:播放完畢";
             46             play_bt.label = "播放";
             47             record_bt.enabled = true;
             48         } 
             49     };
             50 
             51 function PlayStop()
             52 {
             53     video_r._visible = true;
             54     video_p._visible = false;
             55     video_r.attachVideo(my_cam);
             56     record_bt.enabled = true;
             57     play_bt.label = "播放";
             58     rapStatus = "playstop";
             59     netStream.close();
             60     rap_status.text = "當前狀態:播放停止";
             61 
             62 var ser_url = "rtmp://192.168.1.68/r_p";
             63 var rec_date = new Date();
             64 var videoName = String(rec_date.getFullYear()) + String(rec_date.getMonth() + 1+ String(rec_date.getDate()) + String(rec_date.getHours()) + String(rec_date.getMinutes()) + String(rec_date.getSeconds()) + String(rec_date.getMilliseconds());
             65 var netConn = new NetConnection();
             66 netConn.connect(ser_url);
             67 var netStream = new NetStream(netConn);
             68 var my_cam = Camera.get();
             69 if(my_cam == null)
             70 {
             71     rap_status.text = "當前狀態:沒有找到MAC";
             72 }
             73 else
             74 {
             75     video_r.attachVideo(my_cam);
             76     my_cam.setQuality(0100);
             77     my_cam.setKeyFrameInterval(15);
             78     my_cam.setLoopback(true);
             79     my_cam.setMode(32024030true);
             80     netStream.attachVideo(my_cam);
             81     my_cam.onStatus = function(infoObj:Object)
             82     {
             83         if (my_cam.muted) {
             84         // If user is denied access to their Camera, you can display an error message here. You can display the user's Camera/Privacy settings again using System.showSettings(0); 
             85         trace("User denied access to Camera");
             86         System.showSettings(0);
             87         }
             88     }
             89     var my_mic = Microphone.get();
             90     if(my_mic == null)
             91     {
             92         rap_status.text = "當前狀態:沒有找到MIC";
             93     }
             94     else
             95     {
             96         netStream.attachAudio(my_mic);
             97         my_mic.onStatus = function(infoObj:Object)
             98         {
             99             if (my_mic.muted) {
            100             // If user is denied access to their Camera, you can display an error message here. You can display the user's Camera/Privacy settings again using System.showSettings(0); 
            101             trace("User denied access to Camera");
            102             System.showSettings(0);
            103             }
            104         }
            105     }
            106 }
            107 var rapStatus = "free";
            108 netConn.onStatus = function (info)
            109 {
            110     if (info.code == "NetConnection.Connect.Success")
            111     {
            112         conn_status.text = "連接狀態: 連接成功";
            113     }
            114     else
            115     {
            116         conn_status.text = "連接狀態: 連接錯誤";
            117     }
            118 };
            119 var timeNum = 0;
            120 record_bt.onRelease = function ()
            121 {
            122     if (rapStatus == "free" | rapStatus == "recordstop")
            123     {
            124         Record();
            125     }
            126     else if (rapStatus == "recording")
            127     {
            128         RecordStop();
            129     } 
            130 };
            131 play_bt.onRelease = function ()
            132 {
            133     if (rapStatus == "free" | rapStatus == "playstop" | rapStatus == "recordstop")
            134     {
            135         //trace(videolist.length);
            136         if(videolist.length > 0)
            137         {
            138             PlayVideo();
            139         }
            140         else
            141         {
            142             rap_status.text = "當前狀態:沒有視頻";
            143         }
            144     }
            145     else if (rapStatus == "playing")
            146     {
            147         PlayStop();
            148     }
            149 };


            其中conn_status,rap_status,videoinfo為testarea...

            play_bt,record_bt為按鈕...

            videolist為list...

            video_r,video_p為視頻元件(建立方法為:按ctrl+L,然后右擊,新建視頻,命名,拖到場景中,把實例改為前面的名稱就可以了)...

            剩下的...自己試吧...

            參考例子的聲明:
                Powerd By:Cincn.com
                Create By:KeeRula;
                此教程及附帶源文件僅做網友個人交流學習使用.請勿用于商業用途.需要商業版請聯系MSN:Myproductgroup@hotmail.com.
                FLASH技術交流學習群:25448796.
                版權保護:北聯科技.
            posted on 2007-08-12 10:52 譚文政 閱讀(721) 評論(0)  編輯 收藏 引用 所屬分類: Flash ActionScript
            狠狠色丁香婷婷综合久久来| 99久久夜色精品国产网站| 久久久久亚洲精品日久生情| 久久久久久国产精品无码下载| 伊人久久大香线蕉亚洲| 精品国产福利久久久| 中文精品99久久国产 | 亚洲乱亚洲乱淫久久| 亚洲精品无码久久久| 精品国产乱码久久久久久1区2区 | 国产精品99久久99久久久| 亚洲狠狠久久综合一区77777| 久久久久久精品免费看SSS | …久久精品99久久香蕉国产| 香蕉久久永久视频| 国产精品青草久久久久福利99| 国内精品伊人久久久久妇| 9999国产精品欧美久久久久久| 国产aⅴ激情无码久久| 久久国产精品免费一区二区三区| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 久久影视国产亚洲| 久久99国产精品久久99果冻传媒| 久久久精品人妻一区二区三区蜜桃| 久久99精品久久久久久齐齐| 狠狠色丁香久久综合婷婷| 99久久精品日本一区二区免费 | 国产一区二区三区久久精品| 一本一道久久综合狠狠老| 漂亮人妻被中出中文字幕久久| 人妻少妇精品久久| 武侠古典久久婷婷狼人伊人| 女人香蕉久久**毛片精品| 久久精品国产亚洲av麻豆小说 | 狠狠精品干练久久久无码中文字幕 | A级毛片无码久久精品免费| 国产美女久久久| 日韩欧美亚洲综合久久影院d3| 久久99中文字幕久久| 国产精品日韩欧美久久综合| 欧美亚洲日本久久精品|