• LiveGBS GB28181监控平台中语音对讲 浏览器采集音频发送给摄像头的前端实现


    背景分析

    近年来,国内视频监控应用发展迅猛,系统接入规模不断扩大,涌现了大量平台提供商,平台提供商的接入协议各不相同,终端制造商需要给每款终端维护提供各种不同平台的软件版本,造成了极大的资源浪费。各地视频大规模建设后,省级、国家级集中调阅,对重特大事件通过视频掌握现场并进行指挥调度的需求逐步涌现,然而不同平台间缺乏统一的互通协议。在这样的产业背景下,基于终端标准化、平台互联互通的需求,GB/T28181应运而生。

    如下浏览器采集音频源码摘自LiveGBS GB28181流媒体平台的前端web源码:
    https://github.com/livegbs/GB28181-Server

    前端页面语音采集示例

       function  talkStart(e) {
          if(this.recorder) {
            return;
          }
          var $target = $(e.currentTarget);
          LiveRecorder.get((rec, err) => {
            if(err) {
              alert(err);
              return
            }
            this.muted_bak = this.muted;
            this.$refs["player"].setMuted(true);
            $target.addClass("active");
            this.recorder = rec;
            this.recorder.start();
          }, {
            sampleBits: 16,
            sampleRate: 8000,
            pcmCallback: pcm => {
              if(this.bAudioSendError) return;
              var reader = new window.FileReader();
              reader.onloadend = () => {
                var base64 = reader.result;
                var base64 = base64.split(',')[1];
                this.bAudioSending = true;
                $.get("/api/v1/control/talk", {
                  serial: this.serial,
                  code: this.code,
                  audio: base64,
                }).error(() => {
                  if(!this.bAudioSendError) {
                    this.bAudioSendError = true;
                    setTimeout(() => {
                      this.bAudioSendError = false;
                    }, 10000);
                  }
                }).always(() => {
                  this.bAudioSending = false;
                })
              }
              reader.readAsDataURL(pcm);
            }
          })
        }
        function talkStop() {
          if(this.recorder) {
            this.recorder.stop();
            this.recorder = null;
            $(this.$el).find(".fa-microphone.active, .ptz-talk.active").removeClass("active");
            this.$refs["player"].setMuted(this.muted_bak);
            return;
          }
        },
    
  • 相关阅读:
    php.ini中Magic_Quotes_Gpc开关设置
    This is the Manual for Quagga 1.2.0. Quagga is a fork of GNU Zebra
    Are virtual interfaces supported on Quagga v0.98.3 (on Debian GNU/Linux 2.6.16)?
    [quagga-users 8071] Re: Virtual interfaces / aliases supported?
    quagga-0.99.20mr2.1
    Equal Cost Multipath Load Sharing
    (ECMP) Equal-cost multi-path routing
    Multipath suport not working in quagga 0.98.6
    Android-x86-7.1.1
    Android
  • 原文地址:https://www.cnblogs.com/kumukim/p/13921777.html
Copyright © 2020-2023  润新知