·您当前的位置:首页 > 技术教程 > SRS流媒体技术 >

[SRS流媒体服务器]捕捉摄像头的图像后发送到SRS流媒体服务器

时间:2016-01-24 20:39酷播
NetStream.publish捕捉摄像头的图像,并coded-后发送到:SRS流媒体服务器

NetStream.publish捕捉摄像头的图像,并coded-后发送到:SRS流媒体服务器。闪光灯11终于支持发布H264的流。因为推送H264的流,需要flash播放器能编码H264格式视频,在闪存播放器11加入了H264编码器。

官方参考:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/H264VideoStreamSettings.html

编写推送h164的作为程序,必须要较高版本的SDK,之前使用的Flex SDK的4.1的flash播放器版本是10.0,不能用来编写这个程序,。

下载的Flex SDK:

http://www.adobe.com/devnet/flex/flex-sdk-download.html

AS3.0代码:

  1. 包   
  2. {   
  3.     导入 fl.controls.Button;   
  4.     导入 fl.controls.CheckBox;   
  5.     进口 fl.controls.ComboBox;   
  6.     导入 fl.controls.Label;   
  7.     导入 fl.controls.TextInput;   
  8.        
  9.     导入 flash.display.Sprite;   
  10.     导入 flash.display.StageAlign;   
  11.     进口 flash.display.StageScaleMode;   
  12.     导入 flash.events.Event;   
  13.     导入 flash.events.MouseEvent;   
  14.     导入 flash.events.NetStatusEvent;   
  15.     导入 flash.media.Camera;   
  16.     导入 flash.media.H264Profile;   
  17.     进口 flash.media.H264VideoStreamSettings;   
  18.     导入 flash.media.Microphone;   
  19.     进口 flash.media.Video;   
  20.     导入 flash.net.NetConnection;   
  21.     导入 flash.net.NetStream;   
  22.        
  23.     公共 类 H264Publisher的  扩展 雪碧   
  24.     {      
  25.         公共的 功能 H264Publisher()   
  26.         {   
  27.             (此阶段==  空){   
  28.                 this.addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);   
  29.             }   
  30.             其他{   
  31.                 这一点。onAddedToStage(空);   
  32.             }   
  33.         }   
  34.            
  35.         的私人的 功能 onAddedToStage(EVT:事件):无效{   
  36.             这stage.align = StageAlign.TOP_LEFT;   
  37.             这Stage.scaleMode的= StageScaleMode.NO_SCALE;   
  38.                
  39.             VAR  urlPanel:雪碧=  新 雪碧();   
  40.             本。addUrlPanel(urlPanel,onMouseClickStartPublish,onMouseClickStopPublish);   
  41.                
  42.             VAR  cameraPanel:雪碧=  新 雪碧();   
  43.             本。addCameraPanel(cameraPanel);   
  44.                
  45.             VAR  encodingPanel:雪碧=  新 雪碧();   
  46.             本。addEncodingPanel(encodingPanel);   
  47.                
  48.             urlPanel.x = 10;   
  49.             urlPanel.y = 10;   
  50.                
  51.             cameraPanel.x = urlPanel.x;   
  52.             cameraPanel.y = urlPanel.y + 30;   
  53.                
  54.             encodingPanel.x = cameraPanel.x;   
  55.             encodingPanel.y = cameraPanel.y + 30;   
  56.                
  57.             视频=  新 影片();   
  58.             video.x = encodingPanel.x;   
  59.             video.y = encodingPanel.y + 30;   
  60.                
  61.             此。的AddChild(urlPanel);   
  62.             此。的AddChild(cameraPanel);   
  63.             此。的AddChild(encodingPanel);   
  64.             此。的AddChild(视频);   
  65.         }   
  66.            
  67.         私人 VAR  fmsUrl:字符串;   
  68.         私人 VAR  fmsStream:字符串;   
  69.         私人的 功能 discoveryFmsUrl():无效{   
  70.             VAR  参数url:String = txtUrl.text;   
  71.                
  72.             如果(url.toLowerCase()。的indexOf(“RTMP :/ /” )<0){   
  73.                 跟踪(“[错误]的URL必须开始与RTMP :/ /” ,“ 错误” );   
  74.                 返回;   
  75.             }   
  76.                
  77.             / /删除启动RTMP :/ /   
  78.             (url.toLowerCase()的indexOf(URL = url.substr “RTMP :/ /” )+  “RTMP :/ /”的长度。);   
  79.                
  80.             VAR  服务器:字符串= url.substr(0,url.indexOf(“/” ));   
  81.             的URL url.substr(url.indexOf的(“/” )+ 1);   
  82.                
  83.             VAR  端口:字符串=  “1935” ;   
  84.             (server.indexOf( “:” )> = 0){   
  85.                 端口= server.substr(server.indexOf( “:” )+1)的;   
  86.                 服务器= server.substr(0,server.indexOf( “:”   )); 
  87.             }   
  88.                
  89.             VAR  appIndex:INT  = -1;   
  90.             ( I: = 0;我<  这个。cbAppLevel.selectedIndex + 1;我+){   
  91.                 (url.indexOf(“/” ,appIndex + 1)<0){   
  92.                     打破;   
  93.                 }   
  94.                    
  95.                 appIndex = url.indexOf(“/” ,appIndex + 1);   
  96.             }   
  97.             VAR  应用程序:字符串= url.substr(,appIndex);   
  98.             VAR  流:字符串= url.substr(appIndex + 1);   
  99.                
  100.             / /如果用户输入的IP地址,设置服务器,否则,虚拟主机设置。   
  101.             VAR  serverIsIPAddress:布尔=  TRUE ;   
  102.             VAR  serverItems:阵列= server.split( “。” );   
  103.             (I = 0<serverItems.length;我+){   
  104.                 (的isNaN(编号(serverItems [I]))){   
  105.                     serverIsIPAddress =  虚假的;   
  106.                 }   
  107.             }   
  108.                
  109.             fmsUrl =  “RTMP :/ /”  +服务器+  “:”  +端口+  “/”  +应用程序;   
  110.             fmsStream =流;   
  111.         }   
  112.            
  113.         私营 功能 buildEncodingParameters(publishStream:NetStream的,C:摄像机,M:麦克风):无效{   
  114.             VAR  x264profile:字符串=(这cbX264Profile.selectedLabel ==。 “ 主”)?H264Profile.MAIN:H264Profile.BASELINE;   
  115.             VAR  x264level:字符串=  这cbX264Level.selectedLabel;   
  116.             VAR  x264KeyFrameInterval:INTINT  =  INT (此。cbX264KeyFrameInterval.selectedIndex + 1);   
  117.             var cameraWidth:int = int(this.cbCameraSize.selectedLabel.substr(0, this.cbCameraSize.selectedLabel.indexOf("x")));   
  118.             +1));   
  119.             VAR  cameraFps:数=(本cbCameraFps.selectedLabel。);   
  120.             VAR  cameraBitrate:INTINT  =  INT (。cbCameraBitrate.selectedLabel);   
  121.             VAR  cameraQuality:INT  = 85;   
  122.             VAR  microEncodeQuality:INT  = 8;   
  123.             VAR的 microRate:int  = 22;  / / 22 === 22050赫兹   
  124.                
  125.             跟踪(“[发布] H.264(X264)编码参数:    
  126.                 +  “个人资料=”  + x264profile    
  127.                 +  “级=”  + x264level   
  128.                 +  “,keyFrameInterval(GOP)=”  + x264KeyFrameInterval   
  129.                 +  “;视频(摄像头)宽=”  + cameraWidth   
  130.                 +  “,高度=”  + cameraHeight   
  131.                 +  “,FPS =”  + cameraFps   
  132.                 +  “,码率=”  + cameraBitrate   
  133.                 +  “,质量=”  + cameraQuality   
  134.                 +  “;音频(麦克风)encodeQuality的的=”  + microEncodeQuality   
  135.                 +  “,率=”  + microRate  “的(22050Hz的)”   
  136.             );   
  137.                
  138.             VAR  h264Settings:H264VideoStreamSettings = 新 H264VideoStreamSettings();   
  139.             / /我们必须设置其值,然后设置NetStream.videoStreamSettings,它会不断的起源值。   
  140.             h264Settings.setProfileLevel“(x264profile x264level);    
  141.             publishStream.videoStreamSettings = h264Settings;   
  142.             / / setKeyFrameInterval / setMode / setQuality的使用相机设置。   
  143.             / /   
  144.             / /注意:此功能将在未来版本的Flash Player和AIR的支持下,目前,用于相机参数。   
  145.             / * h264Settings.setKeyFrameInterval(4);  
  146.             h264Settings.setMode(800,600,15);  
  147.             h264Settings.setQuality(500,0)* /;   
  148.                
  149.             / /设置摄像头和麦克风。   
  150.                
  151.             / / setKeyFrameInterval的(keyFrameInterval:INT):无效   
  152.             / / keyFrameInterval的:int - 一个值,指定全面传播视频帧(关键帧),而不是被    
  153.             / /插入的视频压缩算法。值1表示每帧是关键帧,价值3手段    
  154.             / /每三帧是关键帧,依此类推。可接受的值是1到48。   
  155.             c.setKeyFrameInterval(x264KeyFrameInterval);   
  156.                
  157.             / / setMode(宽度:INT,高度:INT,FPS:编号,favorArea:布尔=真):无效   
  158.             / /宽度:INT - 请求的捕获宽度,以像素为单位。默认值是160。   
  159.             / /高度:INT - 请求的捕获高度,以像素为单位。默认值是120。   
  160.             / / FPS:编号 - 相机捕捉帧每秒的数据,请求的速率。默认值是15。   
  161.             c.setMode的(cameraWidth,cameraHeight,cameraFps);   
  162.                
  163.             / / setQuality的(带宽:INT,质量:INT):无效   
  164.             / /带宽:int - 指定的最大带宽量,当前输出视频输入可以使用字节每秒,。    
  165.             / /指定的视频可以使用的带宽,需要保持质量的价值,通过对带宽的0。    
  166.             / /默认值是16384。   
  167.             / /质量:int - 一个整数,指定所需的画面质量水平,如压缩量确定    
  168.             / /被应用到每个视频帧。可接受值的范围从1(最低品质,最大压缩)到100    
  169.             / /(最高品质,无压缩)。要指定画面质量可以有所不同,以避免超出带宽,    
  170.             / /通过质量0。   
  171.             / / winlin:   
  172.             / /带宽是在BPS不kbps的。500 * 1000 = 500kbps的。   
  173.             / /质量= 1是最低的质量,100是最高的质量。   
  174.             c.setQuality(cameraBitrate * 1000,cameraQuality);   
  175.                
  176.             / /如果没有麦克风,donot设置的params。   
  177.             如果(M ==  空){   
  178.                 返回;   
  179.             }   
  180.                
  181.             / /使用Speex编解码器时,编码的语音质量。可能的值是从0到10。默认值是6。较高的数字    
  182.             / /代表更高的质量,但需要更多的带宽,如下表所示。所列出的比特率值代表    
  183.             / /净比特率,不包括打包开销。   
  184.             m.encodeQuality = microEncodeQuality;   
  185.                
  186.             / /麦克风捕捉声音千赫,利率。可接受的值是5,8,11,22和44。默认值是8 kHz    
  187.             / /如果您的声音捕获设备支持此值。否则,默认值是高于8 kHz下一个可用捕获级别    
  188.             / /你的声音捕获设备支持,通常为11 kHz。   
  189.             m.rate = microRate;   
  190.         }   
  191.            
  192.         私人的 VAR  publishStream:NetStream的;   
  193.         私人的 VAR  publishConnection:NetConnection对象;   
  194.         私营 功能 onMouseClickStartPublish(EVT:为MouseEvent):无效{   
  195.             / /如果出版,donothing   
  196.             (publishStream!=  空){   
  197.                 返回;   
  198.             }   
  199.                
  200.             这btnStartPublish.enabled =。  假;   
  201.             这btnStopPublish.enabled =。  真实;   
  202.                
  203.             本的。discoveryFmsUrl();   
  204.                
  205.             publishConnection =  新 的NetConnection();   
  206.             VAR  列出的NetConnection = publishConnection;   
  207.                
  208.             conn.client = {};   
  209.             conn.client.onBWDone =  函数():无效{};   
  210.                
  211.             conn.addEventListener(NetStatusEvent.NET_STATUS,  功能(EVT:NetStatusEvent):无效{   
  212.                 跟踪(“[发布] [连接]的代码:”  + evt.info.code);   
  213.                    
  214.                 开关(evt.info.code){   
  215.                     案 “NetConnection.Connect.Success” :   
  216.                         publishStream =  新 的NetStream(CONN);   
  217.                         / /麦克风和摄像头   
  218.                         VAR  M:麦克风= Microphone.getMicrophone(cbMicrophone.selectedIndex);   
  219.                         / /注:该名称是该指数!   
  220.                         VAR  C:相机= Camera.getCamera(字符串(cbCamera.selectedIndex)的);   
  221.                         (C ==  空){   
  222.                             跟踪(“[发布] [错误]无法打开相机(名称=”  +字符串(cbCamera.selectedIndex)+  ):“  + cbCamera.selectedLabel, “ 错误” );   
  223.                             cleanupPublishedStream();   
  224.                             打破;   
  225.                         }   
  226.                         否则, 如果(c.muted){   
  227.                             跟踪(“[发布] [错误]打开相机(名称=”  +字符串(cbCamera.selectedIndex)+  “)失败,这是静音:”  + cbCamera.selectedLabel, “ 错误” );   
  228.                             cleanupPublishedStream();   
  229.                             打破;   
  230.                         }   
  231.                            
  232.                         buildEncodingParameters(publishStream,C,M);   
  233.                            
  234.                         publishStream.addEventListener(NetStatusEvent.NET_STATUS,  功能(EVT:NetStatusEvent):无效{   
  235.                             跟踪(“[发布] [NetStreamStatus]”  + evt.info.code);   
  236.                                
  237.                             开关(evt.info.code){   
  238.                                 案 “NetStream.Publish.Start” :   
  239.                                     VAR  H264:H264VideoStreamSettings =作为H264VideoStreamSettings的publishStream.videoStreamSettings;   
  240.                                     跟踪(“[发布]视频编解码器:”  + h264.codec    
  241.                                         +  “,个人资料=”  + h264.profile   
  242.                                         +  “级=”  + h264.level   
  243.                                         +  “,质量=”  + h264.quality   
  244.                                         +  “,FPS =”  + h264.fps   
  245.                                         +  “,GOP =”  + h264.keyFrameInterval   
  246.                                         +  “,带宽=”  + h264.bandwidth   
  247.                                         +  “,大小=”  + h264.width +  “X”  + h264.height);   
  248.                                     打破;   
  249.                                 情况 :   
  250.                                     cleanupPublishedStream();   
  251.                                     打破;   
  252.                             }   
  253.                         });   
  254.                         publishStream.publish(fmsStream);   
  255.                            
  256.                         / /将视频和音频。   
  257.                         跟踪(“[发布] [调试]开始发布,使用摄像头(名称=”  +字符串(cbCamera.selectedIndex)+  ):“  + c.name);   
  258.                         publishStream.attachCamera(C);   
  259.                         (M =  空 && m.muted的){   
  260.                             跟踪(“[发布] [调试]开始发布,使用麦克风(名称=”  +字符串(cbMicrophone.selectedIndex)+  “):”  + m.name);   
  261.                             publishStream.attachAudio(米);   
  262.                         }   
  263.                         restartPlayback();   
  264.                         打破;   
  265.                     案 “NetConnection.Connect.Rejected” :   
  266.                     案 “NetConnection.Connect.Failed的” :   
  267.                         cleanupPublishedStream();   
  268.                         打破;   
  269.                 }   
  270.             });   
  271.                
  272.             conn.connect(fmsUrl);   
  273.         }   
  274.         私人的 功能 cleanupPublishedStream():无效{   
  275.             这btnStartPublish.enabled =。  真实;   
  276.             这btnStopPublish.enabled =。  假;   
  277.             (此。publishStream!=  空){   
  278.                 本的。publishStream.close();   
  279.             }   
  280.             (此。publishConnection!=  空){   
  281.                 本的。publishConnection.close();   
  282.             }   
  283.             这publishStream =。  空;   
  284.         }   
  285.            
  286.         公共的 VAR  流:NetStream的;   
  287.         私人 VAR  CONN:NetConnection对象;   
  288.         私人的 VAR  视频:视频;   
  289.         私人 功能 restartPlayback():无效{   
  290.             / /流播放,恢复它。   
  291.             (此。流!=  空){   
  292.                 本的。stream.close();   
  293.             }   
  294.                
  295.             CONN =  新 的NetConnection();   
  296.                
  297.             conn.client = {};   
  298.             conn.client.onBWDone =  函数():无效{};   
  299.             conn.addEventListener(NetStatusEvent.NET_STATUS,  功能(EVT:NetStatusEvent):无效{   
  300.                 跟踪(“[连接]代码:”  + evt.info.code +  “DESC:”  + evt.info.description);   
  301.                    
  302.                 开关(evt.info.code){   
  303.                     案 “NetConnection.Connect.Success” :   
  304.                         = 新 的NetStream流  (CONN);   
  305.                         video.attachNetStream(流);   
  306.                            
  307.                         / / stream.bufferTime = 3;   
  308.                         stream.addEventListener(NetStatusEvent.NET_STATUS,  功能(EVT:NetStatusEvent):无效{   
  309.                             跟踪(“[NetStreamStatus]”  + evt.info.code +  “DESC:”  + evt.info.description);   
  310.                         });   
  311.                         stream.client = {};   
  312.                         stream.client.onMetaData,  功能 onMetadata(元数据对象):{   
  313.                             VAR  O:对象= {};   
  314.                             (VAR  关键:字符串  中 的元数据){   
  315.                                 Ø[关键] =元数据[关键];   
  316.                                 跟踪(“元数据”  +  “键 + “值=“ +键  “  + O [关键]);   
  317.                             }   
  318.                                
  319.                             (metadata.width ==未定义){   
  320.                                 metadata.width = 10;   
  321.                                 跟踪(“[警告] metadata.width undefied,设置为10” );   
  322.                             }   
  323.                             (metadata.height ==未定义){   
  324.                                 metadata.height = 10;   
  325.                                 跟踪(“[警告] metadata.height undefied,设置为10” );   
  326.                             }   
  327.                                
  328.                             video.width = metadata.width;   
  329.                             video.height = metadata.height;   
  330.                         };   
  331.                            
  332.                         如果(cbIsLive.selected){   
  333.                             stream.play(fmsStream,0);   
  334.                         }   
  335.                         其他{   
  336.                             stream.play(fmsStream);   
  337.                         }   
  338.                         打破;   
  339.                     案 “NetConnection.Connect.Rejected” :   
  340.                     案 “NetConnection.Connect.Failed的” :   
  341.                         stream.close();   
  342.                         流=  空;   
  343.                         打破;   
  344.                 }   
  345.             });   
  346.             conn.connect(fmsUrl);   
  347.         }   
  348.            
  349.         私营 功能 onMouseClickStopPublish(EVT:为MouseEvent):无效{   
  350.             本的。cleanupPublishedStream();   
  351.         }   
  352.            
  353.         私人 VAR  txtUrl:TextInput的;   
  354.         私人的 VAR  btnStartPublish:按钮;   
  355.         私人的 VAR  btnStopPublish:按钮;   
  356.         私人 VAR  cbAppLevel:ComboBox的;   
  357.         私人 VAR  cbIsLive:CheckBox的;   
  358.         私营 功能 addUrlPanel的(   
  359.             面板:雪碧,    
  360.             的onMouseClickStartPublish:功能,onMouseClickStopPublish的功能   
  361.         ):无效{   
  362.             VAR  lblUrl:标签  新 标签();   
  363.             lblUrl.text =  “RTMP URL:” ;   
  364.             lblUrl.width = 50;   
  365.             panel.addChild(lblUrl);   
  366.                
  367.             txtUrl =  新 的TextInput();   
  368.             txtUrl.width = 380;   
  369.             txtUrl.x = lblUrl.x + lblUrl.width + 3;   
  370.             panel.addChild(txtUrl);   
  371.                
  372.             cbIsLive =  新 的CheckBox();   
  373.             cbIsLive.selected =  真;   
  374.             cbIsLive.label =  “ ​​活” ;   
  375.             cbIsLive.width = 53;   
  376.             cbIsLive.x = txtUrl.x + txtUrl.width + 0;   
  377.             panel.addChild(cbIsLive);   
  378.                
  379.             cbAppLevel =  新 组合框();   
  380.             cbAppLevel.addItem({标签:  “1级应用” });   
  381.             cbAppLevel.addItem({标签:  “2级应用” });   
  382.             cbAppLevel.addItem({标签:  “3级应用” });   
  383.             cbAppLevel.addItem({标签:  “4级应用” });   
  384.             cbAppLevel.width = 70;   
  385.             cbAppLevel.x = cbIsLive.x + cbIsLive.width + 0;   
  386.             panel.addChild(cbAppLevel);   
  387.                
  388.             btnStartPublish =  新 按钮();   
  389.             btnStartPublish.label =  “ ​​发布流” ;   
  390.             btnStartPublish.width = 60;   
  391.             btnStartPublish.x = cbAppLevel.x + cbAppLevel.width + 3;   
  392.             btnStartPublish.addEventListener(MouseEvent.CLICK,onMouseClickStartPublish)的;   
  393.             panel.addChild(btnStartPublish);   
  394.                
  395.             btnStopPublish =  新 按钮();   
  396.             btnStopPublish.label =  “ ​​停止发布” ;   
  397.             btnStopPublish.width = 60;   
  398.             btnStopPublish.enabled =  假 
  399.             btnStopPublish.x = btnStartPublish.x + btnStartPublish.width + 3;   
  400.             btnStopPublish.addEventListener(MouseEvent.CLICK,onMouseClickStopPublish)的;   
  401.             panel.addChild(btnStopPublish);   
  402.         }   
  403.            
  404.         私人的 VAR  cbX264Profile:ComboBox的;   
  405.         私人 VAR  cbX264Level:ComboBox的;   
  406.         私人的 VAR  cbX264KeyFrameInterval:ComboBox的;   
  407.         私人的 VAR  cbCameraSize:ComboBox的;   
  408.         私人的 VAR  cbCameraFps:ComboBox的;   
  409.         私人的 VAR  cbCameraBitrate:ComboBox的;   
  410.         私营 功能 addEncodingPanel的(   
  411.             面板:雪碧   
  412.         ):无效{   
  413.             VAR  lblX264Profile:标签  新 标签();   
  414.             lblX264Profile.text =  “简介:” ;   
  415.             lblX264Profile.width = 38;   
  416.             lblX264Profile.y = 2;   
  417.             panel.addChild(lblX264Profile);   
  418.                
  419.             cbX264Profile =  新 的ComboBox();   
  420.             cbX264Profile.width = 72;   
  421.             cbX264Profile.x = lblX264Profile.x + lblX264Profile.width + 0;   
  422.             panel.addChild(cbX264Profile);   
  423.             cbX264Profile.addItem({标签:“基准” });   
  424.             cbX264Profile.addItem({标签:“主” });   
  425.                
  426.             VAR  lblX264Level:标签  新 标签();   
  427.             lblX264Level.text =  “等级:” ;   
  428.             lblX264Level.width = 32;   
  429.             lblX264Level.y = 2;   
  430.             lblX264Level.x = cbX264Profile.x + cbX264Profile.width + 1;   
  431.             panel.addChild(lblX264Level);   
  432.                
  433.             cbX264Level =  新 组合框();   
  434.             cbX264Level.width = 45;   
  435.             cbX264Level.x = lblX264Level.x + lblX264Level.width + 1;   
  436.             panel.addChild(cbX264Level);   
  437.             VAR  x264Levels:阵列= [ “1” ,  “1B” ,  “1.1” ,  “1.2” ,  “1.3” ,  “2” , “2.1” ,  “2.2” ,  “3” ,  “3.1” ,  “3.2” ,  “4” ,  “4.1” “4.2” ,  “5” ,  “5.1” ];   
  438.             ( I: = 0;我<x264Levels.length;我+){   
  439.                 cbX264Level.addItem({标签:x264Levels [I]});   
  440.             }   
  441.             cbX264Level.selectedIndex = 8;   
  442.                
  443.             VAR  lblX264KeyFrameInterval:标签  新 标签();   
  444.             lblX264KeyFrameInterval.text =  “共和党” ;   
  445.             lblX264KeyFrameInterval.width = 29;   
  446.             lblX264KeyFrameInterval.y = 2;   
  447.             lblX264KeyFrameInterval.x = cbX264Level.x + cbX264Level.width + 1;   
  448.             panel.addChild(lblX264KeyFrameInterval);   
  449.                
  450.             cbX264KeyFrameInterval =  新 的ComboBox();   
  451.             cbX264KeyFrameInterval.width = 87;   
  452.             cbX264KeyFrameInterval.x = lblX264KeyFrameInterval.x + lblX264KeyFrameInterval.width + 1;   
  453.             panel.addChild(cbX264KeyFrameInterval);   
  454.             (I = 0; I <48; I + +){   
  455.                 cbX264KeyFrameInterval.addItem({标签:字符串(I + 1)+  “秒” });   
  456.             }   
  457.             cbX264KeyFrameInterval.selectedIndex = 3;   
  458.                
  459.             VAR  lblCameraSize:标签  新 标签();   
  460.             lblCameraSize.text =  “大小:” ;   
  461.             lblCameraSize.width = 30;   
  462.             lblCameraSize.y = 2;   
  463.             lblCameraSize.x = cbX264KeyFrameInterval.x + cbX264KeyFrameInterval.width + 1;   
  464.             panel.addChild(lblCameraSize);   
  465.                
  466.             cbCameraSize =  新 的ComboBox();   
  467.             cbCameraSize.width = 82;   
  468.             cbCameraSize.x = lblCameraSize.x + lblCameraSize.width + 1;   
  469.             panel.addChild(cbCameraSize);   
  470.             VAR  大小:阵列= 
  471.             (I = 0<sizes.length;我+){   
  472.                 cbCameraSize.addItem({标签:大小[I]});   
  473.             }   
  474.             cbCameraSize.selectedIndex = 1;   
  475.                
  476.             VAR  lblCameraFps:标签=  新 标签();   
  477.             lblCameraFps.text =  “的FPS:” ;   
  478.             lblCameraFps.width = 28;   
  479.             lblCameraFps.y = 2;   
  480.             lblCameraFps.x = cbCameraSize.x + cbCameraSize.width + 1;   
  481.             panel.addChild(lblCameraFps);   
  482.                
  483.             cbCameraFps =  新 组合框();   
  484.             cbCameraFps.width = 58;   
  485.             cbCameraFps.x = lblCameraFps.x + lblCameraFps.width + 1;   
  486.             panel.addChild(cbCameraFps);   
  487.             VAR  fpses:阵列= 
  488.             (I = 0<fpses.length;我+){   
  489.                 cbCameraFps.addItem({标签:fpses [I]});   
  490.             }   
  491.             cbCameraFps.selectedIndex = 8;   
  492.                
  493.             VAR  lblCameraBitrate:标签  新 标签();   
  494.             lblCameraBitrate.text =  “比特率” ;   
  495.             lblCameraBitrate.width = 40;   
  496.             lblCameraBitrate.y = 2;   
  497.             lblCameraBitrate.x = cbCameraFps.x + cbCameraFps.width + 1;   
  498.             panel.addChild(lblCameraBitrate);   
  499.                
  500.             cbCameraBitrate =  新 的ComboBox();   
  501.             cbCameraBitrate.width = 58;   
  502.             cbCameraBitrate.x = lblCameraBitrate.x + lblCameraBitrate.width + 1;   
  503.             panel.addChild(cbCameraBitrate);   
  504.             VAR  比特率:阵列= 
  505.             (I = 0<bitrates.length;我+){   
  506.                 cbCameraBitrate.addItem({标签:比特率[I]});   
  507.             }   
  508.             cbCameraBitrate.selectedIndex = 3;   
  509.         }   
  510.            
  511.         私人的 VAR  cbCamera:ComboBox的;   
  512.         私人的 VAR  cbMicrophone:ComboBox的;   
  513.         私营 功能 addCameraPanel的(   
  514.             面板:雪碧   
  515.         ):无效{   
  516.             / /摄像头   
  517.             VAR  lblCamera:标签  新 标签();   
  518.             lblCamera.text =  “可用的摄像头:” ;   
  519.             lblCamera.width = 100;   
  520.             panel.addChild(lblCamera);   
  521.                
  522.             cbCamera =  新 组合框();   
  523.             cbCamera.width = 160;   
  524.             cbCamera.x = lblCamera.x + lblCamera.width + 3;   
  525.             panel.addChild(cbCamera);   
  526.                
  527.             VAR  相机:阵列= Camera.names;   
  528.             ( I: = 0;我<cameras.length;我+){   
  529.                 cbCamera.addItem({标签:相机[I]});   
  530.             }   
  531.                
  532.             / /麦克风   
  533.             VAR  lblMicrophone:标签  新 标签();   
  534.             lblMicrophone.text =  “可用的麦克风:” ;   
  535.             lblMicrophone.width = 120;   
  536.             lblMicrophone.x = cbCamera.x + cbCamera.width + 10;   
  537.             panel.addChild(lblMicrophone);   
  538.                
  539.             cbMicrophone =  新 组合框();   
  540.             cbMicrophone.width = 180;   
  541.             cbMicrophone.x = lblMicrophone.x + lblMicrophone.width + 3;   
  542.             panel.addChild(cbMicrophone);   
  543.                
  544.             VAR  麦克风:阵列= Microphone.names;   
  545.             (I = 0<microphones.length;我+){   
  546.                 cbMicrophone.addItem({标签:麦克风[I]});   
  547.             }   
  548.         }   
  549.     }   
  550. }   

 

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器