Commit f4c3f324 by yuananting

fix:企微录音mac调用

parent 449c3bb3
/*
* @Author: wufan
* @Date: 2021-05-11 10:21:37
* @LastEditors: wufan
* @LastEditTime: 2021-06-02 16:51:26
* @LastEditors: yuananting
* @LastEditTime: 2021-06-09 14:16:08
* @Description: 企业微信api
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import User from "@/common/js/user";
import Service from "@/common/js/service";
import Platform from "@/core/platform";
export default class WechatApi {
static async initConfig(params = { isAgentConfig: false, url: "" }) {
......@@ -29,6 +30,7 @@ export default class WechatApi {
"shareToExternalContact",
"selectExternalContact",
"selectEnterpriseContact",
'startRecord',
],
});
......@@ -129,4 +131,10 @@ export default class WechatApi {
});
});
}
static startRecord() {
if (Platform.isWorkWx()) {
wx.startRecord();
}
}
}
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-03-18 10:01:28
* @LastEditors: yuananting
* @LastEditTime: 2021-03-27 14:44:31
* @LastEditTime: 2021-06-09 14:20:59
* @Description: 录音组件
*/
......@@ -12,6 +12,8 @@ import { Button, Modal } from "antd";
import UploadOss from "@/core/upload";
import { RECORD_ERROR } from "@/common/constants/academic";
import AudioRecorder from "../components/audioRecord";
import Platform from '@/core/platform';
import WechatApi from "@/common/js/wechatApi";
import "./XMRecord.less";
......@@ -84,7 +86,10 @@ class XMRecord extends Component {
};
handleStartRecord = () => {
navigator.mediaDevices
if(Platform.isWorkWx()) { // 企业微信
WechatApi.startRecord();
} else {
navigator.mediaDevices
.getUserMedia({
audio: true,
})
......@@ -93,6 +98,7 @@ class XMRecord extends Component {
this.mMediaRecorder.start();
this.handleCountTime();
}, this.openDeviceFailure);
}
};
onProcessData = (audioData) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment