语音修改

This commit is contained in:
lvyuankang 2025-01-02 11:01:09 +08:00
parent c1f27d8d5a
commit ac95a82524
7 changed files with 31 additions and 23 deletions

View File

@ -39,7 +39,7 @@ export default async function request(req: any) {
try {
let baseUrl=host?host:globalThis.host
// let baseUrl=host?config.csptHost:config.host'
console.log('响应头地址' + baseUrl,url)
console.log('响应头地址1' + baseUrl,url,options.extraData.length)
const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, {...options});
// fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
// writeLog({

View File

@ -39,7 +39,7 @@ export default struct Index {
private vocObj = null;
// private AccountTable = new AccountTable(()=>{},CommonConstants);
onPageShow() {
aboutToAppear() {
const that = this
this.vocObj = new voiceService(async (status, val, next) => {
if (!that.breakFlag) {

View File

@ -4,7 +4,7 @@ import { examinerLoginService } from '../common/service/ExaminerService';
import Md5 from '../common/utils/md5';
import promptAction from '@ohos.promptAction';
import errorMsgDialog from './compontents/errorMsgDialog'
import { voiceService } from '../common/service/voiceService';
// import { voiceService } from '../common/service/voiceService';
import imageBtn from './compontents/imageBtn'
@Entry
@ -18,7 +18,7 @@ export default struct Index {
@State currentInputIndex: number = 0
@State limit: boolean = false
@State @Watch('outClick') outFlag: boolean = false;
private vocObj = null;
// private vocObj = null;
private title = ''
private type = '2'
errorDialog: CustomDialogController = new CustomDialogController({
@ -181,8 +181,8 @@ export default struct Index {
}
onPageShow() {
this.vocObj = new voiceService(async (status, val, next) => {
});
// this.vocObj = new voiceService(async (status, val, next) => {
// });
}
outClick() {

View File

@ -22,6 +22,7 @@ import UdpEvent from '../common/utils/UdpEvent'
import UIAbility from '@ohos.app.ability.UIAbility';
import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService';
import imageBtn from './compontents/imageBtn'
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
@ -45,7 +46,8 @@ struct Index {
fileHelper = null;
private fileUtil: FileUtil
private interval = null;
private vocObj = null;
// private vocObj = null;
private avPlayer
private workerInstance = null;
private context = getContext(this) as common.UIAbilityContext;
errorDialog: CustomDialogController = new CustomDialogController({
@ -332,6 +334,8 @@ struct Index {
}
async aboutToAppear() {
console.log('diyidiy')
this.avPlayer = new VoiceAnnounce();
this.initParamFlag=false
this.dialogVisiable = false
this.angle = 0
@ -341,6 +345,10 @@ struct Index {
globalThis.udpEvent = new UdpEvent();
}
aboutToDisappear() {
// this.vocObj && this.vocObj.releasePlayer()
}
async testXMLToJSONInWorker() {
if (this.loading) {
return
@ -431,23 +439,25 @@ struct Index {
globalThis.udpClient2.sendMsgExt(param, this.context)
}
}
async onPageShow() {
console.log('ttttt', 1111)
await this.userAuth();
let resourceManager = this.context.resourceManager;
this.vocObj = new voiceService(async (status, val, next) => {
});
// this.vocObj = new voiceService(async (status, val, next) => {
// });
console.log('globalThis.singlePlay', globalThis.singlePlay)
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
setVideoParam()
// setVideoParam()
console.log('diyidiy')
this.context.resourceManager.getRawFileContent("welcome.wav").then(value => {
this.vocObj.playAudio({
type: 1,
name: 'welcome.wav'
})
this.avPlayer.playAudio(['welcome.wav'])
// this.vocObj.playAudio({
// type: 1,
// name: 'welcome.wav'
// })
// let rawFile = value;
}).catch(error => {
console.log("getRawFileContent promise error is " + error);

View File

@ -11,7 +11,7 @@ export default struct Index {
@State hasAuth: boolean = false;
@State url: string = ''
@State @Watch('outClick') outFlag: boolean = false;
private vocObj = null;
// private vocObj = null;
build() {
Column() {
@ -87,8 +87,8 @@ export default struct Index {
}
aboutToAppear() {
this.vocObj = new voiceService(async (status, val, next) => {
});
// this.vocObj = new voiceService(async (status, val, next) => {
// });
this.carNum = globalThis.carInfo.plateNo;
this.version = globalThis.version;
this.hasAuth = globalThis.hasAuth;

View File

@ -133,7 +133,9 @@ struct UserInfo {
alignment: DialogAlignment.Center,
},
)
aboutToAppear(){
this.avPlayer = new VoiceAnnounce();
}
async onPageShow() {
this.startExam=false
this.updateTimeLimit = false
@ -216,7 +218,6 @@ struct UserInfo {
this.isExamStart = false
this.sczbkf = [];
this.avPlayer = new VoiceAnnounce();
initJudgeUdp()
//监听远程开始考试

View File

@ -51,9 +51,6 @@ export default struct TopLogo {
}
async aboutToAppear() {
console.log('jiangsong: topLogo aboutToAppear1111')
this.vocObj = new voiceService(async (status, val, next) => {
});
this.timeText = await getCurrentTime();
this.timer = setInterval(async () => {
this.timeText = await getCurrentTime();