|
@@ -245,7 +245,7 @@ ${arr.map(row => `<tr>
|
|
|
|
|
|
console.log("需要上传的文件", audioFile)
|
|
|
this.uploadFileMixin(audioFile).then(upload => {
|
|
|
- console.log("upload=>",upload)
|
|
|
+ console.log("upload=>", upload)
|
|
|
resolve({ audioUrl: upload, fileObj: audioFile })
|
|
|
})
|
|
|
} catch (error) {
|
|
@@ -1255,92 +1255,153 @@ CH:${_CH}
|
|
|
|
|
|
let timer = null;
|
|
|
|
|
|
- timer = setTimeout(() => {//五分钟无响应就算报错
|
|
|
- resolve({ data: 1, transcriptionContent: null, editorBarData: null, err: "转录超时" })
|
|
|
- }, 180000)
|
|
|
|
|
|
- // 转录中
|
|
|
- iframeRef.contentWindow.onRecognizedResult = (e) => {
|
|
|
- let privText = e.privText;
|
|
|
- let privSpeakerId = e.privSpeakerId;
|
|
|
- let copySpeakerId = e.copySpeakerId;
|
|
|
- let privDuration = e.privDuration;
|
|
|
- let privOffset = e.privOffset;
|
|
|
-
|
|
|
- console.log("转录内容",e)
|
|
|
- if (timer) {
|
|
|
- clearTimeout(timer)
|
|
|
- timer = setTimeout(() => {//五分钟无响应就算报错
|
|
|
- resolve({ data: 1, transcriptionContent: null, editorBarData: null, err: "转录超时" })
|
|
|
- }, 180000)
|
|
|
- }
|
|
|
- if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {//不记录
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- _endTime = (privOffset + privDuration) / 10000000;
|
|
|
-
|
|
|
- tableList.push({
|
|
|
- value: privText,
|
|
|
- startTime: this.updateRecordedTimeMixin({ duration: _startTime }),
|
|
|
- endTime: this.updateRecordedTimeMixin({ duration: _endTime }),
|
|
|
- time: this.updateRecordedTimeMixin({ duration: _endTime - _startTime }),
|
|
|
- role: privSpeakerId,
|
|
|
- code: ""
|
|
|
- });
|
|
|
-
|
|
|
- _startTime = _endTime;
|
|
|
- transcriptionContent += copySpeakerId + ":" + privText + "\n";
|
|
|
- };
|
|
|
-
|
|
|
- //转录结束
|
|
|
- iframeRef.contentWindow.onSessionStopped = async (e) => {
|
|
|
- if (timer) {
|
|
|
- clearTimeout(timer)
|
|
|
- }
|
|
|
- tableContent = `<table
|
|
|
- border="0"
|
|
|
- width="100%"
|
|
|
- cellpadding="0"
|
|
|
- cellspacing="0"
|
|
|
- style="text-align: center"
|
|
|
->
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <th>序号</th>
|
|
|
- <th>开始时间</th>
|
|
|
- <th>结束时间</th>
|
|
|
- <th>发言内容</th>
|
|
|
- <th>时长</th>
|
|
|
- <th>说话人身份</th>
|
|
|
- <th>行为编码</th>
|
|
|
- </tr>`;
|
|
|
- tableList.forEach((item, index) => {
|
|
|
- tableContent += `<tr>
|
|
|
- <td>${index + 1}</td>
|
|
|
- <td>${item.startTime}</td>
|
|
|
- <td>${item.endTime}</td>
|
|
|
- <td>${item.value}</td>
|
|
|
- <td>${item.time}</td>
|
|
|
- <td>${item.role}</td>
|
|
|
- <td>${item.code}</td>
|
|
|
- </tr>`
|
|
|
- })
|
|
|
-
|
|
|
- // tableContent += `<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>`
|
|
|
-
|
|
|
- var blob = new Blob([tableContent], { type: "text/plain;charset=utf-8" });
|
|
|
- blob.lastModifiedDate = new Date();
|
|
|
- blob.name = `classroomObservation.txt`;
|
|
|
- this.uploadFileMixin(blob).then(upload => {
|
|
|
- resolve({ transcriptionContent: transcriptionContent, editorBarData: { type: "0", url: upload.Location, content: tableContent, tableList: tableList } })
|
|
|
+ iframeRef.contentWindow.window
|
|
|
+ .doConversationTranscriber({ files: [file] })
|
|
|
+ .then(res => {
|
|
|
+ console.log("转录内容", res);
|
|
|
+
|
|
|
+ let _data = res.phrases;
|
|
|
+
|
|
|
+ _data.forEach(i => {
|
|
|
+ let _privSpeakerId = `Guest-${i.speaker}`;
|
|
|
+ let _privText = i.text;
|
|
|
+ let privOffset = i.offsetMilliseconds;
|
|
|
+ let privDuration = i.durationMilliseconds;
|
|
|
+
|
|
|
+ _endTime = (privOffset + privDuration) / 1000;
|
|
|
+ textList.push({
|
|
|
+ value: _privText,
|
|
|
+ startTime: this.updateRecordedTimeMixin({ duration: _startTime }),
|
|
|
+ endTime: this.updateRecordedTimeMixin({ duration: _endTime }),
|
|
|
+ time: this.updateRecordedTimeMixin({
|
|
|
+ duration: _endTime - _startTime
|
|
|
+ }),
|
|
|
+ role: _privSpeakerId,
|
|
|
+ code: ""
|
|
|
+ });
|
|
|
+ _startTime = _endTime;
|
|
|
+ transcriptionContent +=
|
|
|
+ _privSpeakerId + ":" + _privText + "\n";
|
|
|
+ });
|
|
|
+ let _result = `<table border="0" width="100%" cellpadding="0" cellspacing="0" style="text-align: center"><tbody><tr><th>序号</th><th>开始时间</th><th>结束时间</th><th>发言内容</th><th>时长</th><th>说话人身份</th><th>行为编码</th></tr>`;
|
|
|
+ textList.forEach((item, index) => {
|
|
|
+ _result += `<tr><td>${index + 1}</td><td>${item.startTime}</td><td>${item.endTime}</td><td>${item.value}</td><td>${item.time}</td><td>${item.role}</td><td>${item.code}</td></tr>`;
|
|
|
+ });
|
|
|
+ _result += `</tbody></table>`;
|
|
|
+ // this.editorBarData.content = _result;
|
|
|
+ this.$forceUpdate();
|
|
|
+ var blob = new Blob([_result], { type: "text/plain;charset=utf-8" });
|
|
|
+ blob.lastModifiedDate = new Date();
|
|
|
+ blob.name = `classroomObservation.txt`;
|
|
|
+ this.uploadFileMixin(blob).then(upload => {
|
|
|
+ resolve({ transcriptionContent: transcriptionContent, editorBarData: { type: "0", url: upload.Location, content: _result, tableList: textList } })
|
|
|
+ })
|
|
|
+ // this.wavGetTextProgress = 100;
|
|
|
+ // if (this.wavFileGetTextLoading) this.$message.success("转译完成");
|
|
|
+ // // _this.editorBarData.content += privText;
|
|
|
+
|
|
|
+ // this.showGetTextLoading = false;
|
|
|
+ // this.wavGetTextLoading = false;
|
|
|
+ // this.uploadFileLoading = false;
|
|
|
+ // // this.uploadWavFile(audioFile);
|
|
|
+ // if (_timer) {
|
|
|
+ // clearInterval(_timer);
|
|
|
+ // }
|
|
|
+ // this.saveEditorBar();
|
|
|
})
|
|
|
- };
|
|
|
+ .catch(err => {
|
|
|
+ resolve({ data: 1, transcriptionContent: null, editorBarData: null, err: err })
|
|
|
+ // console.log(err)
|
|
|
+ // this.wavGetTextLoading = false;
|
|
|
+ // this.showGetTextLoading = false;
|
|
|
+ });
|
|
|
+ // timer = setTimeout(() => {//五分钟无响应就算报错
|
|
|
+ // resolve({ data: 1, transcriptionContent: null, editorBarData: null, err: "转录超时" })
|
|
|
+ // }, 180000)
|
|
|
|
|
|
- //开始转录
|
|
|
- iframeRef.contentWindow.ConversationTranscriber({
|
|
|
- files: [file]
|
|
|
- });
|
|
|
+ // 转录中
|
|
|
+ // iframeRef.contentWindow.onRecognizedResult = (e) => {
|
|
|
+ // let privText = e.privText;
|
|
|
+ // let privSpeakerId = e.privSpeakerId;
|
|
|
+ // let copySpeakerId = e.copySpeakerId;
|
|
|
+ // let privDuration = e.privDuration;
|
|
|
+ // let privOffset = e.privOffset;
|
|
|
+
|
|
|
+ // console.log("转录内容",e)
|
|
|
+ // if (timer) {
|
|
|
+ // clearTimeout(timer)
|
|
|
+ // timer = setTimeout(() => {//五分钟无响应就算报错
|
|
|
+ // resolve({ data: 1, transcriptionContent: null, editorBarData: null, err: "转录超时" })
|
|
|
+ // }, 180000)
|
|
|
+ // }
|
|
|
+ // if (!privText || !privSpeakerId || privSpeakerId == "Unknown") {//不记录
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // _endTime = (privOffset + privDuration) / 10000000;
|
|
|
+
|
|
|
+ // tableList.push({
|
|
|
+ // value: privText,
|
|
|
+ // startTime: this.updateRecordedTimeMixin({ duration: _startTime }),
|
|
|
+ // endTime: this.updateRecordedTimeMixin({ duration: _endTime }),
|
|
|
+ // time: this.updateRecordedTimeMixin({ duration: _endTime - _startTime }),
|
|
|
+ // role: privSpeakerId,
|
|
|
+ // code: ""
|
|
|
+ // });
|
|
|
+
|
|
|
+ // _startTime = _endTime;
|
|
|
+ // transcriptionContent += copySpeakerId + ":" + privText + "\n";
|
|
|
+ // };
|
|
|
+
|
|
|
+ // //转录结束
|
|
|
+ // iframeRef.contentWindow.onSessionStopped = async (e) => {
|
|
|
+ // if (timer) {
|
|
|
+ // clearTimeout(timer)
|
|
|
+ // }
|
|
|
+ // tableContent = `<table
|
|
|
+ // border="0"
|
|
|
+ // width="100%"
|
|
|
+ // cellpadding="0"
|
|
|
+ // cellspacing="0"
|
|
|
+ // style="text-align: center"
|
|
|
+ // >
|
|
|
+ // <tbody>
|
|
|
+ // <tr>
|
|
|
+ // <th>序号</th>
|
|
|
+ // <th>开始时间</th>
|
|
|
+ // <th>结束时间</th>
|
|
|
+ // <th>发言内容</th>
|
|
|
+ // <th>时长</th>
|
|
|
+ // <th>说话人身份</th>
|
|
|
+ // <th>行为编码</th>
|
|
|
+ // </tr>`;
|
|
|
+ // tableList.forEach((item, index) => {
|
|
|
+ // tableContent += `<tr>
|
|
|
+ // <td>${index + 1}</td>
|
|
|
+ // <td>${item.startTime}</td>
|
|
|
+ // <td>${item.endTime}</td>
|
|
|
+ // <td>${item.value}</td>
|
|
|
+ // <td>${item.time}</td>
|
|
|
+ // <td>${item.role}</td>
|
|
|
+ // <td>${item.code}</td>
|
|
|
+ // </tr>`
|
|
|
+ // })
|
|
|
+
|
|
|
+ // // tableContent += `<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>`
|
|
|
+
|
|
|
+ // var blob = new Blob([tableContent], { type: "text/plain;charset=utf-8" });
|
|
|
+ // blob.lastModifiedDate = new Date();
|
|
|
+ // blob.name = `classroomObservation.txt`;
|
|
|
+ // this.uploadFileMixin(blob).then(upload => {
|
|
|
+ // resolve({ transcriptionContent: transcriptionContent, editorBarData: { type: "0", url: upload.Location, content: tableContent, tableList: tableList } })
|
|
|
+ // })
|
|
|
+ // };
|
|
|
+
|
|
|
+ // //开始转录
|
|
|
+ // iframeRef.contentWindow.ConversationTranscriber({
|
|
|
+ // files: [file]
|
|
|
+ // });
|
|
|
})
|
|
|
|
|
|
},
|