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

教人做美食的网站沈阳网站建设开发

教人做美食的网站,沈阳网站建设开发,北京商场排名前十,小程序制作收款技术背景 我们在对接Unity平台camera场景采集的时候#xff0c;除了常规的RTMP推送、录像外#xff0c;还有一些开发者#xff0c;需要能实现轻量级RTSP服务#xff0c;对外提供个拉流的RTSP URL。 目前我们在Windows平台Unity下数据源可采集到以下部分#xff1a; 采集…技术背景 我们在对接Unity平台camera场景采集的时候除了常规的RTMP推送、录像外还有一些开发者需要能实现轻量级RTSP服务对外提供个拉流的RTSP URL。 目前我们在Windows平台Unity下数据源可采集到以下部分 采集Unity camera场景采集摄像头采集屏幕采集Unity声音采集麦克风采集扬声器Unity PCM混音 对外提供的技术能力有 RTMP直播推送轻量级RTSP服务实时录像、暂停|恢复录像实时预览。 以下录制下来的MP4文件是采集Unity camera场景音频是unity声音。 Unity平台实现camera场景实时录像 技术实现 实际上在实现Unity平台音视频能力之前我们原生模块已经有非常成熟的技术积累Unity下还是调用的原生的推送模块不同的是数据源需要采集Unity的audio、video然后高效的投递到底层模块底层模块负责编码打包并投递到RTMP或RTSP服务。 先说支持的音视频类型 public void SelVideoPushType(int type){switch (type){case 0:video_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_VIDEO_OPTION.NT_PB_E_VIDEO_OPTION_LAYER; //采集Unity窗体break;case 1:video_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_VIDEO_OPTION.NT_PB_E_VIDEO_OPTION_CAMERA; //采集摄像头break;case 2:video_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_VIDEO_OPTION.NT_PB_E_VIDEO_OPTION_SCREEN; //采集屏幕break;case 3:video_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_VIDEO_OPTION.NT_PB_E_VIDEO_OPTION_NO_VIDEO; //不采集视频break;}Debug.Log(SelVideoPushType type: type video_push_type: video_push_type_);}public void SelAudioPushType(int type){switch (type){case 0:audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_EXTERNAL_PCM_DATA; //采集Unity声音break;case 1:audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_CAPTURE_MIC; //采集麦克风break;case 2:audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_CAPTURE_SPEAKER; //采集扬声器break;case 3:audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_TWO_EXTERNAL_PCM_MIXER; //两路Unity AudioClip混音测试break;case 4:audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_NO_AUDIO; //不采集音频break;}Debug.Log(SelAudioPushType type: type audio_push_type: audio_push_type_);} 采集音视频数据 private void StartCaptureAvData(){if (audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_EXTERNAL_PCM_DATA|| audio_push_type_ (uint)NTSmartPublisherDefine.NT_PB_E_AUDIO_OPTION.NT_PB_E_AUDIO_OPTION_TWO_EXTERNAL_PCM_MIXER){PostUnityAudioClipData();}textures_poll_ new TexturesPool();post_image_worker_ new PostImageWorker(textures_poll_, publisher_wrapper_);post_worker_thread_ new Thread(post_image_worker_.run);post_worker_thread_.Start();}private void StopCaptureAvData(){if (post_image_worker_ ! null){post_image_worker_.requestStop();post_image_worker_ null;}if (post_worker_thread_ ! null){post_worker_thread_.Join();post_worker_thread_ null;}if (textures_poll_ ! null){textures_poll_.clear();textures_poll_ null;}StopAudioSource();} RTMP推送 public void btn_start_rtmp_pusher_Click(){if (publisher_wrapper_.IsPushingRtmp()){StopPushRTMP();btn_rtmp_pusher_.GetComponentInChildrenText().text 推送RTMP;return;}String url rtmp_pusher_url_.text;if (url.Length 8){publisher_wrapper_.Close();Debug.LogError(请输入RTMP推送地址);return;}if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsRecording()){publisher_wrapper_.SetVideoPushType(video_push_type_);publisher_wrapper_.SetAudioPushType(audio_push_type_);}if (!publisher_wrapper_.StartRtmpPusher(url)){Debug.LogError(调用StartPublisher失败..);return;}btn_rtmp_pusher_.GetComponentInChildrenText().text 停止推送;if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsRecording()){StartCaptureAvData();coroutine_ StartCoroutine(OnPostVideo());}} 轻量级RTSP服务相关调用 public void btn_rtsp_service_Click(){if (publisher_wrapper_.IsRtspServiceRunning()){publisher_wrapper_.StopRtspService();btn_rtsp_service_.GetComponentInChildrenText().text 启动RTSP服务;btn_rtsp_publisher_.interactable false;return;}if (!publisher_wrapper_.StartRtspService()){Debug.LogError(调用StartRtspService失败..);return;}btn_rtsp_publisher_.interactable true;btn_rtsp_service_.GetComponentInChildrenText().text 停止RTSP服务;}public void btn_rtsp_publisher_Click(){if (publisher_wrapper_.IsRtspPublisherRunning()){publisher_wrapper_.StopRtspStream();if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsPushingRtmp() !publisher_wrapper_.IsRecording()){StopCaptureAvData();if (coroutine_ ! null){StopCoroutine(coroutine_);coroutine_ null;}}btn_rtsp_service_.interactable true;btn_rtsp_publisher_.GetComponentInChildrenText().text 发布RTSP;}else{if (!publisher_wrapper_.IsRtspServiceRunning()){Debug.LogError(RTSP service is not running..);return;}if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsPushingRtmp() !publisher_wrapper_.IsRecording()){publisher_wrapper_.SetVideoPushType(video_push_type_);publisher_wrapper_.SetAudioPushType(audio_push_type_);}publisher_wrapper_.StartRtspStream();if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsPushingRtmp() !publisher_wrapper_.IsRecording()){StartCaptureAvData();coroutine_ StartCoroutine(OnPostVideo());}btn_rtsp_publisher_.GetComponentInChildrenText().text 停止RTSP;btn_rtsp_service_.interactable false;}}public void btn_get_rtsp_session_numbers_Click(){if (publisher_wrapper_.IsRtspServiceRunning()){btn_get_rtsp_session_numbers_.GetComponentInChildrenText().text RTSP会话数: publisher_wrapper_.GetRtspSessionNumbers();}} 实时录像调用 public void btn_record_Click(){if (publisher_wrapper_.IsRecording()){StopRecord();btn_record_.GetComponentInChildrenText().text 开始录像;return;}if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsPushingRtmp()){publisher_wrapper_.SetVideoPushType(video_push_type_);publisher_wrapper_.SetAudioPushType(audio_push_type_);}if (!publisher_wrapper_.StartRecorder()){Debug.LogError(调用StartRecorder失败..);return;}btn_record_.GetComponentInChildrenText().text 停止录像;if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsPushingRtmp()){StartCaptureAvData();coroutine_ StartCoroutine(OnPostVideo());}}public void StopRecord(){if (!publisher_wrapper_.IsPreviewing() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsPushingRtmp()){StopCaptureAvData();if (coroutine_ ! null){StopCoroutine(coroutine_);coroutine_ null;}}publisher_wrapper_.StopRecorder();}private void btn_pause_record_Click(){if (!publisher_wrapper_.IsPublisherHandleAvailable()){return;}String btn_pause_rec_text btn_pause_record_.GetComponentInChildrenText().text;if (暂停录像 btn_pause_rec_text){UInt32 ret publisher_wrapper_.PauseRecorder(true);if ((UInt32)NT.NTSmartPublisherDefine.NT_PB_E_ERROR_CODE.NT_ERC_PB_NEED_RETRY ret){Debug.LogError(暂停录像失败, 请重新尝试!);return;}else if (NTBaseCodeDefine.NT_ERC_OK ret){btn_pause_record_.GetComponentInChildrenText().text 恢复录像;}}else{UInt32 ret publisher_wrapper_.PauseRecorder(false);if ((UInt32)NT.NTSmartPublisherDefine.NT_PB_E_ERROR_CODE.NT_ERC_PB_NEED_RETRY ret){Debug.LogError(恢复录像失败, 请重新尝试!);return;}else if (NTBaseCodeDefine.NT_ERC_OK ret){btn_pause_record_.GetComponentInChildrenText().text 暂停录像;}}} 实时预览相关 public void btn_preview_Click(){if (btn_preview_.GetComponentInChildrenText().text.Equals(本地预览)){if (!publisher_wrapper_.IsPushingRtmp() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsRecording()){publisher_wrapper_.SetVideoPushType(video_push_type_);}if (publisher_wrapper_.StartPreview()){btn_preview_.GetComponentInChildrenText().text 停止预览;}if (!publisher_wrapper_.IsPushingRtmp() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsRecording()){StartCaptureAvData();coroutine_ StartCoroutine(OnPostVideo());}}else{if (!publisher_wrapper_.IsPushingRtmp() !publisher_wrapper_.IsRtspPublisherRunning() !publisher_wrapper_.IsRecording()){StopCaptureAvData();if (coroutine_ ! null){StopCoroutine(coroutine_);coroutine_ null;}}publisher_wrapper_.StopPreview();btn_preview_.GetComponentInChildrenText().text 本地预览;}} 总结 Unity平台下RTMP推送、录像、轻量级RTSP服务在虚拟仿真、医疗、教育等场景下应用非常广泛。要实现低延迟除了需要高效率的音视频数据采集编码和数据投递外还需要好的直播播放器支持。配合我们的SmartPlayer可轻松实现毫秒级体验满足绝大多数应用场景技术诉求。
http://www.huolong8.cn/news/5786/

相关文章:

  • 高端大气的科技网站模板xampp网站后台
  • flash网站模板帮小公司代账一个月费用
  • ps做产品的网站大连网站建设招标
  • 东莞高端品牌网站建设网站开发广告语大全
  • 简述网站的建设方案2021安全员证报名入口
  • 自建站网站做调查问卷权威网站
  • 聚合猫网站建设花蝴蝶免费直播视频在线观看
  • 常德网站开发服务包小盒设计网站官网
  • 临沂网站维护公司厦门零基础学seo
  • 制作自己网站有什么用计算机专业网站开发开题报告
  • 搭建dede网站服务器企业seo多少费用
  • 承接网站建设文案遵义仁怀网站建设
  • 网站备案号图标简述常用的网络营销方法有哪些
  • 坪山城市建设局官方网站太原网站模板
  • 发布文章后马上更新网站主页自己的电脑做服务器建立网站的方法
  • 群晖可以做几个网站it行业公司排名
  • 网站建设盐城建站管理过程
  • 外国的贸易网站定做微信小程序
  • 在什么网站上做自媒体网站检测中心
  • 麦积区建设局网站wordpress分类列表插件
  • 央企网站建设百度做免费推广的步骤
  • 精品资源共享课网站建设无极网页游戏
  • 河南省建设厅网站wordpress建站服务器选择
  • 广元网站建设工作室建个微商城网站多少钱
  • 制作链接的app的软件温州哪里有网站优化
  • 网站开发策略烟台主流网站
  • 推进门户网站建设工作会议做网站主要学什么
  • 网站制作什么品牌好华为虚拟主机
  • 学校网站怎么做的好坏微信小店可以做分类网站
  • 做论坛网站要多少配置的服务器Wordpress+仿站+工具