Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_njstar
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
middleLayer_for_njstar
Commits
e419ccc6
Commit
e419ccc6
authored
Aug 10, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 录音
parent
149b2a7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
23 deletions
+8
-23
air.js
assets/middleLayer_for_njstar/script/air.js
+7
-22
supportToos.js
assets/middleLayer_for_njstar/script/supportToos.js
+1
-1
No files found.
assets/middleLayer_for_njstar/script/air.js
View file @
e419ccc6
...
...
@@ -2,6 +2,8 @@
const
testMockData
=
{
"
eof
"
:
1
,
"
file
"
:
"
/storage/emulated/0/Android/data/com.example.oxford/cache/shengtong/gradeVoice.mp3
"
,
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/db48d49e122ba65aa7c5ee56963418a6.mp3
"
,
"
result
"
:{
"
duration
"
:
"
2.470
"
,
"
fluency
"
:
100
,
"
integrity
"
:
100
,
"
kernel_version
"
:
"
3.6.7
"
,
"
overall
"
:
99
,
"
pronunciation
"
:
99
,
"
resource_version
"
:
"
2.3.6
"
,
"
rhythm
"
:
0
,
"
speed
"
:
78
},
"
tokenId
"
:
"
621c32543327932cfc000002
"
};
const
recordMockData
=
{
"
text
"
:
"
what can i do for you
"
,
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/368ad56174f85e2ff1f39f12bac5c693.mp3
"
};
import
{
supportMethod
,
initRecorder
}
from
"
./supportToos
"
;
export
function
initAir
(
_this
)
{
const
realAir
=
{
uploadUrl
:
""
,
...
...
@@ -66,6 +68,10 @@ export function initAir(_this) {
}
catch
(
e
)
{
console
.
error
(
"
浏览器不支持ES6新特性Proxy/Reflect,请使用谷歌浏览器!
"
);
}
// 初始化个录音组件
initRecorder
();
window
.
courseware
=
{
getData
(
callback
)
{
_this
.
log
(
"
===成功调用getData===
"
);
...
...
@@ -310,28 +316,7 @@ export function initAir(_this) {
callOcMethod
(
method
,
param
)
{
const
paramStr
=
JSON
.
stringify
(
param
);
_this
.
log
(
`===成功调用原生方法
${
method
}
===参数==
${
paramStr
}
`
);
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
RootViewController
'
,
`
${
method
}
:`
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
com/iplayabc/cocos/AppActivity
'
,
method
,
'
(Ljava/lang/String;)Ljava/lang/String;
'
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_WINDOWS
)
{
console
.
log
(
'
汪汪汪
'
)
}
else
{
console
.
error
(
`非源生环境,网页版不支持
${
method
}
方法,将返回此方法的Mock数据以便于网页版调试使用`
);
if
(
method
==
'
getEngineInfo
'
){
window
.
air
.
getEngineInfoCallback
({
isDev
:
0
,
uuid
:
'
debug-xxxxxx-xxxxxx
'
});
}
else
if
(
method
==
'
startTest
'
)
{
}
else
if
(
method
==
'
stopTest
'
)
{
window
.
air
.
testCallBack
(
testMockData
);
}
else
if
(
method
==
'
startRecord
'
)
{
}
else
if
(
method
==
'
stopRecord
'
)
{
window
.
air
.
recordCallBack
(
recordMockData
);
}
else
if
(
method
==
'
startBuyToAppStore
'
)
{
window
.
air
.
startBuyToAppStoreCallBack
({
productid
:
1
,
puid
:
22
,
receiptData
:
"
HelloWorld
"
,
error
:
""
});
}
else
{
console
.
error
(
`
${
method
}
方法还没有Mock数据,请联系技术支持人员添加`
);
}
}
supportMethod
(
method
,
param
);
},
freeAllOcMethod
()
{
if
(
window
.
courseware
.
hasCalledStartRecord
)
{
...
...
assets/middleLayer_for_njstar/script/supportToos.js
View file @
e419ccc6
...
...
@@ -139,7 +139,7 @@ export function supportMethod (method, param) {
}
}
else
if
(
cc
.
sys
.
isBrowser
)
{
if
(
method
==
'
getEngineInfo
'
){
window
.
air
.
getEngineInfoCallback
({
isDev
:
1
,
uuid
:
'
debug-xxxxxx
-xxxxxx
'
});
window
.
air
.
getEngineInfoCallback
({
isDev
:
0
,
uuid
:
'
debug-njstar
-xxxxxx
'
});
}
else
if
(
method
==
'
startTest
'
)
{
// 初始化参数
initSkKouYuParms
(
param
.
params
,
'
para.eval
'
);
...
...
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