当前位置: 首页 > news >正文

wordpress 网站统计插件福建省建设工程职业注册网站

wordpress 网站统计插件,福建省建设工程职业注册网站,河北建设工程招标网,广州网站建设报价表好多开发者苦于很难在unity3d下实现RTMP直播推送#xff0c;本次以大牛直播SDK#xff08;Github#xff09;的Windows平台RTMP推送模块#xff08;以推摄像头为例#xff0c;如需推屏幕数据#xff0c;设置相关参数即可#xff09;为例#xff0c;介绍下unity3d的RTMP…好多开发者苦于很难在unity3d下实现RTMP直播推送本次以大牛直播SDKGithub的Windows平台RTMP推送模块以推摄像头为例如需推屏幕数据设置相关参数即可为例介绍下unity3d的RTMP推送集成。 简单来说Unity3D环境下可以直接调用C#的接口封装针对此我们先做了一层封装 nt_publisher_wrapper.cs核心代码如下 初始化和基础参数设置 private bool InitSDK(){if (!is_pusher_sdk_init_){// 设置日志路径(请确保目录存在)String log_path D:\\pulisherlog;NTSmartLog.NT_SL_SetPath(log_path);UInt32 isInited NTSmartPublisherSDK.NT_PB_Init(0, IntPtr.Zero);if (isInited ! 0){Debug.Log(调用NT_PB_Init失败..);return false;}is_pusher_sdk_init_ true;}return true;} public bool OpenPublisherHandle(uint video_option, uint audio_option){if (publisher_handle_ ! IntPtr.Zero){return true;}publisher_handle_count_ 0;if (NTBaseCodeDefine.NT_ERC_OK ! NTSmartPublisherSDK.NT_PB_Open(out publisher_handle_,video_option, audio_option, 0, IntPtr.Zero)){return false;}if (publisher_handle_ ! IntPtr.Zero){pb_event_call_back_ new NT_PB_SDKEventCallBack(PbEventCallBack);NTSmartPublisherSDK.NT_PB_SetEventCallBack(publisher_handle_, IntPtr.Zero, pb_event_call_back_);return true;}else{return false;}} private void SetCommonOptionToPublisherSDK(){if (!IsPublisherHandleAvailable()){Debug.Log(SetCommonOptionToPublisherSDK, publisher handle with null..);return;}CameraInfo camera cameras_[cur_sel_camera_index_];NT_PB_VideoCaptureCapability cap camera.capabilities_[cur_sel_camera_resolutions_index_];SetVideoCaptureDeviceBaseParameter(camera.id_.ToString(), (UInt32)cap.width_, (UInt32)cap.height_);SetFrameRate((UInt32)CalBitRate(edit_key_frame_, cap.width_, cap.height_));SetVideoEncoderType(is_h264_encoder ? 1 : 2);SetVideoQualityV2(CalVideoQuality(cap.width_, cap.height_, is_h264_encoder));SetVideoMaxBitRate((CalMaxKBitRate(edit_key_frame_, cap.width_, cap.height_, false)));SetVideoKeyFrameInterval((edit_key_frame_));if (is_h264_encoder){SetVideoEncoderProfile(1);}SetVideoEncoderSpeed(CalVideoEncoderSpeed(cap.width_, cap.height_, is_h264_encoder));// 音频相关设置SetAuidoInputDeviceId(0);SetPublisherAudioCodecType(1);SetPublisherMute(is_mute);SetInputAudioVolume(Convert.ToSingle(edit_audio_input_volume_));} 预览、停止预览 public bool StartPreview(){if(CheckPublisherHandleAvailable() false)return false;video_preview_image_callback_ new NT_PB_SDKVideoPreviewImageCallBack(SDKVideoPreviewImageCallBack);NTSmartPublisherSDK.NT_PB_SetVideoPreviewImageCallBack(publisher_handle_, (int)NTSmartPublisherDefine.NT_PB_E_IMAGE_FORMAT.NT_PB_E_IMAGE_FORMAT_RGB32, IntPtr.Zero, video_preview_image_callback_);if (NTBaseCodeDefine.NT_ERC_OK ! NTSmartPublisherSDK.NT_PB_StartPreview(publisher_handle_, 0, IntPtr.Zero)){if (0 publisher_handle_count_){NTSmartPublisherSDK.NT_PB_Close(publisher_handle_);publisher_handle_ IntPtr.Zero;}return false;}publisher_handle_count_;is_previewing_ true;return true;}public void StopPreview(){if (is_previewing_ false) return;is_previewing_ false;publisher_handle_count_--;NTSmartPublisherSDK.NT_PB_StopPreview(publisher_handle_);if (0 publisher_handle_count_){NTSmartPublisherSDK.NT_PB_Close(publisher_handle_);publisher_handle_ IntPtr.Zero;}} 开始推送、停止推送 public bool StartPublisher(String url){if (CheckPublisherHandleAvailable() false) return false;if (publisher_handle_ IntPtr.Zero){return false;}if (!String.IsNullOrEmpty(url)){NTSmartPublisherSDK.NT_PB_SetURL(publisher_handle_, url, IntPtr.Zero);}if (NTBaseCodeDefine.NT_ERC_OK ! NTSmartPublisherSDK.NT_PB_StartPublisher(publisher_handle_, IntPtr.Zero)){if (0 publisher_handle_count_){NTSmartPublisherSDK.NT_PB_Close(publisher_handle_);publisher_handle_ IntPtr.Zero;}is_publishing_ false;return false;}publisher_handle_count_;is_publishing_ true;return true;}public void StopPublisher(){if (is_publishing_ false) return;publisher_handle_count_--;NTSmartPublisherSDK.NT_PB_StopPublisher(publisher_handle_);if (0 publisher_handle_count_){NTSmartPublisherSDK.NT_PB_Close(publisher_handle_);publisher_handle_ IntPtr.Zero;}is_publishing_ false;} 相关event事件回调 private void PbEventCallBack(IntPtr handle, IntPtr user_data, UInt32 event_id,Int64 param1,Int64 param2,UInt64 param3,UInt64 param4,[MarshalAs(UnmanagedType.LPStr)] String param5,[MarshalAs(UnmanagedType.LPStr)] String param6,IntPtr param7){String event_log ;switch (event_id){case (uint)NTSmartPublisherDefine.NT_PB_E_EVENT_ID.NT_PB_E_EVENT_ID_CONNECTING:event_log 连接中;if (!String.IsNullOrEmpty(param5)){event_log event_log url: param5;}break;case (uint)NTSmartPublisherDefine.NT_PB_E_EVENT_ID.NT_PB_E_EVENT_ID_CONNECTION_FAILED:event_log 连接失败;if (!String.IsNullOrEmpty(param5)){event_log event_log url: param5;}break;case (uint)NTSmartPublisherDefine.NT_PB_E_EVENT_ID.NT_PB_E_EVENT_ID_CONNECTED:event_log 已连接;if (!String.IsNullOrEmpty(param5)){event_log event_log url: param5;}break;case (uint)NTSmartPublisherDefine.NT_PB_E_EVENT_ID.NT_PB_E_EVENT_ID_DISCONNECTED:event_log 断开连接;if (!String.IsNullOrEmpty(param5)){event_log event_log url: param5;}break;default:break;}if(OnLogEventMsg ! null) OnLogEventMsg.Invoke(event_id, event_log);} SmartPublishWinMono.cs 调用上述封装的代码即可本地预览的话拿到回调的RGB数据在unity3d上层刷下即可如下图 经测试unity3d下RTMP推送配合RTMP播放端依然可以实现毫秒级延迟的推拉流体验。
http://www.pierceye.com/news/915125/

相关文章:

  • 建站教程视频下载视频直播软件开发
  • 后缀cc的网站php网站开发实例教程代码百度云
  • 注册好域名之后怎么做个人网站如何用服务器代替空间做网站
  • 电商网站建设懂你所需网络品牌营销推广途径
  • 10大免费软件下载网站推荐购物网站域名大小
  • 网站建设项目安排计划表wordpress博客官网登陆账号密码
  • 无锡网络公司网站建设app微信公众号平平面设计培训价格
  • 免费的黄冈网站有哪些平台可以用微信支付制作网站的步骤和过程
  • 杭州的网站设计公司漂亮的网站是什么建设出来的
  • 全屏网站代码佛山专业网站建设公司推荐
  • 自己做信息网站有什么设计网站
  • 检察网站建设请示wordpress 重定向多
  • 做网站用什么服务器比较好线上推广网络公司
  • 长春营销型网站制作内蒙古建设部网站官网
  • 做家教的网站微网站可以自己做吗
  • 网站优化新闻关键词挖掘工具爱网
  • 研究生院 网站 建设广州网站建设策划
  • 企业建站找哪个公司网站退出率
  • 汕头企业建站系统高密微网站建设
  • 企业建设网站个人总结报告中山蓝图科技网站建设
  • 网站规划作品邯郸免费发布信息平台
  • html5手机网站源码网站备案要如何取消
  • 商城建设网站制作微信网站模板源码
  • 品牌型网站制作公司想做百度推广找谁
  • 浙江建设监理协会官方网站网站建设的公司选择哪家好
  • 优秀网站及网址沙漠风网站建设6
  • 做数据表格的网站出口网站建设方案
  • 广州网站建设信息科技有限公司福建省亿力电力建设有限公司网站
  • 电子商务网站开发 ppt湛江做网站报价
  • 网站建设框架图wordpress 固定链接设置