Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ_Game_09
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
JJ_Game_09
Commits
ab109e70
Commit
ab109e70
authored
Mar 21, 2025
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 录音异常兼容处理
parent
4f4ce7d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
16 deletions
+90
-16
.DS_Store
.DS_Store
+0
-0
JJ_Game_09.ts
assets/JJ_Game_09/scene/JJ_Game_09.ts
+90
-16
No files found.
.DS_Store
View file @
ab109e70
No preview for this file type
assets/JJ_Game_09/scene/JJ_Game_09.ts
View file @
ab109e70
...
@@ -458,25 +458,60 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -458,25 +458,60 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layout_loading
.
active
=
true
;
this
.
layout_loading
.
active
=
true
;
if
(
window
[
'
courseware
'
])
{
if
(
window
[
'
courseware
'
])
{
window
[
'
courseware
'
].
stopTest
((
res
)
=>
{
const
overtime
=
7
;
let
isStopTest
=
false
;
let
overtimeId
=
setTimeout
(()
=>
{
if
(
isStopTest
)
{
return
;
}
isStopTest
=
true
;
this
.
isRecording
=
false
;
this
.
isRecording
=
false
;
res
=
JSON
.
parse
(
res
);
},
overtime
*
1000
);
let
list
=
Game
.
getIns
().
lists
if
(
res
&&
res
.
audioUrl
)
{
list
[
this
.
page
].
recordAudio
=
res
.
audioUrl
;
list
[
this
.
page
].
recordScore
=
res
.
overall
;
// this.resetRecord();
}
this
.
showRecordEnd
(
res
);
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
if
(
!
list
[
i
].
recordAudio
||
list
[
i
].
recordAudio
==
""
)
return
;
}
let
send
:
any
=
{};
window
[
'
courseware
'
].
stopTest
(
data
=>
{
send
.
details
=
list
;
if
(
isStopTest
)
{
onHomeworkFinish
(
send
);
return
;
});
}
isStopTest
=
true
;
clearTimeout
(
overtimeId
);
console
.
log
(
'
stopTest data:
'
,
data
);
if
(
data
&&
typeof
(
data
)
==
'
string
'
)
{
console
.
log
(
JSON
.
parse
(
data
));
data
=
JSON
.
parse
(
data
)
}
this
.
setRecordItemAudio
(
data
);
});
// window['courseware'].stopTest((res) => {
// this.isRecording = false;
// res = JSON.parse(res);
// let list = Game.getIns().lists
// if (res && res.audioUrl) {
// list[this.page].recordAudio = res.audioUrl;
// list[this.page].recordScore = res.overall;
// // this.resetRecord();
// }
// this.showRecordEnd(res);
// for (let i = 0; i < list.length; i++) {
// if (!list[i].recordAudio || list[i].recordAudio == "") return;
// }
// let send: any = {};
// send.details = list;
// onHomeworkFinish(send);
// });
}
else
{
}
else
{
let
res
=
{
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/bea0ba87bcf8bc09815f34b4790ffac9.mp3
"
,
"
eof
"
:
1
,
"
file
"
:
"
/storage/emulated/0/Android/data/com.example.oxford/cache/shengtong/gradeVoice.mp3
"
,
"
result
"
:
{
"
duration
"
:
"
2.670
"
,
"
fluency
"
:
86
,
"
integrity
"
:
50
,
"
kernel_version
"
:
"
3.7.1
"
,
"
overall
"
:
28
,
"
pronunciation
"
:
28
,
"
resource_version
"
:
"
2.3.11
"
,
"
rhythm
"
:
28
,
"
sentences
"
:
[{
"
beginIndex
"
:
0
,
"
details
"
:
[{
"
charType
"
:
0
,
"
end
"
:
0
,
"
overall
"
:
56
,
"
prominence
"
:
0
,
"
start
"
:
0
,
"
word
"
:
"
Good
"
},
{
"
charType
"
:
0
,
"
end
"
:
0
,
"
overall
"
:
0
,
"
prominence
"
:
0
,
"
start
"
:
0
,
"
word
"
:
"
morning
"
}],
"
end
"
:
0
,
"
endIndex
"
:
0
,
"
overall
"
:
28
,
"
sentence
"
:
"
Good morning
"
,
"
start
"
:
0
}],
"
speed
"
:
28
},
"
tokenId
"
:
"
62d7a2343327934258000009
"
}
let
res
=
{
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/bea0ba87bcf8bc09815f34b4790ffac9.mp3
"
,
"
eof
"
:
1
,
"
file
"
:
"
/storage/emulated/0/Android/data/com.example.oxford/cache/shengtong/gradeVoice.mp3
"
,
"
result
"
:
{
"
duration
"
:
"
2.670
"
,
"
fluency
"
:
86
,
"
integrity
"
:
50
,
"
kernel_version
"
:
"
3.7.1
"
,
"
overall
"
:
28
,
"
pronunciation
"
:
28
,
"
resource_version
"
:
"
2.3.11
"
,
"
rhythm
"
:
28
,
"
sentences
"
:
[{
"
beginIndex
"
:
0
,
"
details
"
:
[{
"
charType
"
:
0
,
"
end
"
:
0
,
"
overall
"
:
56
,
"
prominence
"
:
0
,
"
start
"
:
0
,
"
word
"
:
"
Good
"
},
{
"
charType
"
:
0
,
"
end
"
:
0
,
"
overall
"
:
0
,
"
prominence
"
:
0
,
"
start
"
:
0
,
"
word
"
:
"
morning
"
}],
"
end
"
:
0
,
"
endIndex
"
:
0
,
"
overall
"
:
28
,
"
sentence
"
:
"
Good morning
"
,
"
start
"
:
0
}],
"
speed
"
:
28
},
"
tokenId
"
:
"
62d7a2343327934258000009
"
}
...
@@ -488,6 +523,45 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -488,6 +523,45 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
}
}
setRecordItemAudio
(
data
)
{
this
.
isRecording
=
false
;
if
(
data
.
errCode
)
{
return
;
}
const
audioUrl
=
data
.
audioUrl
;
// 只做预加载用一下
if
(
!
audioUrl
)
{
return
;
}
const
overall
=
data
.
result
?.
overall
;
const
integrity
=
data
.
result
?.
integrity
;
let
score
=
overall
//integrity * 0.4 + overall * 0.6; //data.result?.overall;
let
list
=
Game
.
getIns
().
lists
;
if
(
audioUrl
)
{
list
[
this
.
page
].
recordAudio
=
audioUrl
;
list
[
this
.
page
].
recordScore
=
score
;
// this.resetRecord();
}
this
.
showRecordEnd
(
data
);
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
if
(
!
list
[
i
].
recordAudio
||
list
[
i
].
recordAudio
==
""
)
return
;
}
let
send
:
any
=
{};
send
.
details
=
list
;
onHomeworkFinish
(
send
);
}
private
showTip
(
str
)
{
private
showTip
(
str
)
{
const
mdler
=
global
[
"
middleLayer
"
];
const
mdler
=
global
[
"
middleLayer
"
];
if
(
mdler
)
{
if
(
mdler
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment