南昌市物联网技防平台-前端
shuishen
2021-02-01 41a7f6de32bb90f71a8db7d2bb5ba98f2aa74c5f
修改PCM处理
1 files modified
90 ■■■■■ changed files
src/views/realTimePolice/real.vue 90 ●●●●● patch | view | raw | blame | history
src/views/realTimePolice/real.vue
@@ -273,17 +273,8 @@
      </el-form>
    </el-dialog>
    <el-drawer
      title="电子地图"
      append-to-body="true"
      :visible.sync="showMap"
    >
      <iframe
        :src="mapUrl"
        frameborder="0"
        width="100%"
        height="100%"
      ></iframe>
    <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
      <iframe :src="mapUrl" frameborder="0" width="100%" height="100%"></iframe>
    </el-drawer>
  </basic-container>
</template>
@@ -302,7 +293,7 @@
  data() {
    return {
      showMap: false,
      mapUrl:"https://s16s652780.51mypc.cn/jfpt/map/index.html",
      mapUrl: "https://s16s652780.51mypc.cn/jfpt/map/index.html",
      hls: "",
      videoSource: "",
      dialogTableVisible: false,
@@ -764,7 +755,8 @@
    },
    handleMap() {
      this.showMap = true;
      this.mapUrl = "https://s16s652780.51mypc.cn/jfpt/map/index.html?openid=PatrolManagement"
      this.mapUrl =
        "https://s16s652780.51mypc.cn/jfpt/map/index.html?openid=PatrolManagement";
    },
    handleManage(row) {
      this.form = row;
@@ -906,7 +898,6 @@
      };
    },
    queryOldVideo(data) {
      console.log(data);
      var newAxios = axios.create({
        baseURL: "https://s16s652780.51mypc.cn",
        withCredentials: false,
@@ -928,8 +919,6 @@
          }
        )
        .then(res => {
          console.log(res.data.data.accessToken);
          newAxios
            .get(
              `/GetPlayUrl?deviceCode=${data.channelNumber}&chl=${data.serialNumber}`
@@ -974,11 +963,7 @@
        this.hls = new Hls();
        console.log(this.videoSource, "19028321321r073");
        var m3u8Url = decodeURIComponent(this.videoSource);
        console.log(m3u8Url);
        this.hls.loadSource(m3u8Url);
@@ -999,7 +984,7 @@
      }
    },
    aKeyToCall(e, form) {
      var newAxios = axios.create({
      var newCallAxios = axios.create({
        baseURL: "https://s16s652780.51mypc.cn",
        withCredentials: false,
        headers: {
@@ -1011,7 +996,7 @@
      if (this.isActive == true) {
        this.isActive = false;
        newAxios
        newCallAxios
          .post(
            `/api_control`,
            {},
@@ -1022,18 +1007,29 @@
            }
          )
          .then(result => {
            console.log(result, 11111111);
            var formData = new FormData();
            var blob = this.recorder.getPCMBlob() //获取wav格式音频数据
            var blob = this.recorder.getPCMBlob(); //获取pcm格式音频数据
            //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData
            var newbolb = new Blob([blob], { type: "audio/pcm" });
            var fileOfBlob = new File([newbolb], new Date().getTime() + ".pcm");
            formData.append("file", fileOfBlob);
            console.log(blob, newbolb, fileOfBlob, 99999);
            document
              .getElementById("real_audio")
              .setAttribute("src", URL.createObjectURL(blob));
            newAxios
              .post(`/api_control`, formData, {
            console.log(
              blob,
              newbolb,
              fileOfBlob,
              window.URL.createObjectURL(blob),
              99999
            );
            this.recorder.play();
            newCallAxios
              .post(`/api_control`, blob, {
                params: {
                  param: {
                    PktType: "Talk",
@@ -1042,46 +1038,16 @@
                  }
                }
              })
              .then(result => {
                console.log(result);
              });
              .then(result => {});
          });
      } else {
        this.isActive = true;
        Recorder.getPermission().then(
          () => {
            console.log("给权限了");
            this.recorder.start().then(
              () => {
                // 开始录音
                console.log("开始录音了");
              },
              error => {
                // 出错了
                console.log(`${error.name} : ${error.message}`);
              }
            );
          },
          error => {
            console.log(`${error.name} : ${error.message}`);
          }
        );
        var newAxios = axios.create({
          baseURL: "https://s16s652780.51mypc.cn",
          withCredentials: false,
          headers: {
            "Content-Type": "application/json;"
          }
        });
        newAxios
          .post(`/talk?deviceCode=${form.channelNumber}`, "12345")
          .then(result => {
            console.log(result);
        Recorder.getPermission().then(() => {
          this.recorder.start().then(() => {
            // 开始录音
          });
        });
      }
    }
  }