@ccos/ccsdk-lite 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle.js +193 -148
- package/lib/core/index.d.ts +1 -0
- package/lib/index.d.ts +6 -1
- package/lib/log/index.d.ts +19 -0
- package/package.json +1 -1
package/lib/bundle.js
CHANGED
|
@@ -60,6 +60,8 @@ var bus = new Bus();
|
|
|
60
60
|
var hasInitialized = false;
|
|
61
61
|
var actionList = []; // 这里保存, 未注册命令处理函数之前,APP发过来的命令
|
|
62
62
|
var apiCode = '';
|
|
63
|
+
var nativeObject = null;
|
|
64
|
+
var nativeType = '';
|
|
63
65
|
function defaultAppCmd(cmd, payload) {
|
|
64
66
|
console.log('default appCmd ' + cmd);
|
|
65
67
|
actionList.push({ cmd: cmd, payload: payload }); // 有可能APP发过来的命令比较早,而页面的一些初始化还没有做完,这时把命令先存起来,放到 actionList 中
|
|
@@ -84,6 +86,10 @@ function unsetAppCommandCallback() {
|
|
|
84
86
|
appCmdProcessor = defaultAppCmd;
|
|
85
87
|
actionList = [];
|
|
86
88
|
}
|
|
89
|
+
function setNativeObject(obj, _type) {
|
|
90
|
+
nativeObject = obj;
|
|
91
|
+
nativeType = _type;
|
|
92
|
+
}
|
|
87
93
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
88
94
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
89
95
|
var persistentCallbackMap = new Map(); // 持久化 callback-id 与回调函数对应的列表 (回调函数可以多个,组成一个Set)
|
|
@@ -128,6 +134,18 @@ function nativeCall(funcName, callbackId, params) {
|
|
|
128
134
|
apkNativeCallJs(resData);
|
|
129
135
|
});
|
|
130
136
|
}
|
|
137
|
+
else if (nativeObject) {
|
|
138
|
+
if (nativeType == 'cocos') {
|
|
139
|
+
// 运行于 android 的 cocos 平台
|
|
140
|
+
var object2 = {
|
|
141
|
+
func: funcName,
|
|
142
|
+
id: callbackId,
|
|
143
|
+
params: params || {},
|
|
144
|
+
apiCode: apiCode,
|
|
145
|
+
};
|
|
146
|
+
nativeObject.reflection.callStaticMethod('com/coocaa/cocos_game/UniNativeAPI', 'callToHostApp', "(Ljava/lang/String;)V", JSON.stringify(object2));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
131
149
|
}
|
|
132
150
|
function nativeRequest(funcName, params, persistent, persistentIdName, persistentCallback) {
|
|
133
151
|
if (!persistent) {
|
|
@@ -239,9 +257,9 @@ function initSDK() {
|
|
|
239
257
|
return callNative('tiny' + num4.toString(), null);
|
|
240
258
|
}
|
|
241
259
|
|
|
242
|
-
var moduleName$
|
|
243
|
-
function getFuncName$
|
|
244
|
-
return moduleName$
|
|
260
|
+
var moduleName$a = 'network';
|
|
261
|
+
function getFuncName$a(name) {
|
|
262
|
+
return moduleName$a + '_' + name;
|
|
245
263
|
}
|
|
246
264
|
function paramToUrl(params) {
|
|
247
265
|
if (!params)
|
|
@@ -273,7 +291,7 @@ function paramToUrl(params) {
|
|
|
273
291
|
}
|
|
274
292
|
// 简单的 HTTP 请求
|
|
275
293
|
function simpleHttpRequest(params) {
|
|
276
|
-
return callNative(getFuncName$
|
|
294
|
+
return callNative(getFuncName$a('simpleHttpRequest'), params);
|
|
277
295
|
}
|
|
278
296
|
function httpGet(url, urlParam, header, base64) {
|
|
279
297
|
var paramString = paramToUrl(urlParam);
|
|
@@ -372,19 +390,19 @@ function httpSseGet(url, urlParam, header, base64) {
|
|
|
372
390
|
}
|
|
373
391
|
// 获取网络的基本信息
|
|
374
392
|
function getNetworkInfo() {
|
|
375
|
-
return callNative(getFuncName$
|
|
393
|
+
return callNative(getFuncName$a('getNetworkInfo'), null);
|
|
376
394
|
}
|
|
377
395
|
// 获取合规化后的域名
|
|
378
396
|
function getDomainName(domain) {
|
|
379
|
-
return callNative(getFuncName$
|
|
397
|
+
return callNative(getFuncName$a('getDomainName'), { domain: domain });
|
|
380
398
|
}
|
|
381
399
|
// 获取基本 Header 信息
|
|
382
400
|
function getCommonHeader() {
|
|
383
|
-
return callNative(getFuncName$
|
|
401
|
+
return callNative(getFuncName$a('getCommonHeader'), null);
|
|
384
402
|
}
|
|
385
403
|
// 读取SSE流
|
|
386
404
|
function readSse(params) {
|
|
387
|
-
return callNative(getFuncName$
|
|
405
|
+
return callNative(getFuncName$a('readSse'), params);
|
|
388
406
|
}
|
|
389
407
|
// 下载一个文件到设备本地
|
|
390
408
|
// url : 需要下载的链接
|
|
@@ -401,7 +419,7 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
|
|
|
401
419
|
if (header === void 0) { header = ''; }
|
|
402
420
|
if (postType === void 0) { postType = ''; }
|
|
403
421
|
if (body === void 0) { body = ''; }
|
|
404
|
-
return callNative(getFuncName$
|
|
422
|
+
return callNative(getFuncName$a('downloadToFile'), {
|
|
405
423
|
url: url,
|
|
406
424
|
tempFlag: tempFlag,
|
|
407
425
|
method: method,
|
|
@@ -421,39 +439,39 @@ var network = {
|
|
|
421
439
|
downloadToFile: downloadToFile,
|
|
422
440
|
};
|
|
423
441
|
|
|
424
|
-
var moduleName$
|
|
425
|
-
function getFuncName$
|
|
426
|
-
return moduleName$
|
|
442
|
+
var moduleName$9 = 'app';
|
|
443
|
+
function getFuncName$9(name) {
|
|
444
|
+
return moduleName$9 + '_' + name;
|
|
427
445
|
}
|
|
428
446
|
function getUserInfo() {
|
|
429
|
-
return callNative(getFuncName$
|
|
447
|
+
return callNative(getFuncName$9('getUserInfo'), null);
|
|
430
448
|
}
|
|
431
449
|
function getHostAppInfo() {
|
|
432
|
-
return callNative(getFuncName$
|
|
450
|
+
return callNative(getFuncName$9('getHostAppInfo'), null);
|
|
433
451
|
}
|
|
434
452
|
function startPage(params) {
|
|
435
|
-
return callNative(getFuncName$
|
|
453
|
+
return callNative(getFuncName$9('startPage'), params);
|
|
436
454
|
}
|
|
437
455
|
function startActivity(params) {
|
|
438
|
-
return callNative(getFuncName$
|
|
456
|
+
return callNative(getFuncName$9('startPage'), params);
|
|
439
457
|
}
|
|
440
458
|
function exitPage() {
|
|
441
|
-
callNative(getFuncName$
|
|
459
|
+
callNative(getFuncName$9('exitPage'), null);
|
|
442
460
|
}
|
|
443
461
|
function movePageToBack() {
|
|
444
|
-
return callNative(getFuncName$
|
|
462
|
+
return callNative(getFuncName$9('movePageToBack'), null);
|
|
445
463
|
}
|
|
446
464
|
function startService(params) {
|
|
447
|
-
return callNative(getFuncName$
|
|
465
|
+
return callNative(getFuncName$9('startService'), params);
|
|
448
466
|
}
|
|
449
467
|
function getInstalledAppInfo(params) {
|
|
450
|
-
return callNative(getFuncName$
|
|
468
|
+
return callNative(getFuncName$9('getInstalledAppInfo'), params);
|
|
451
469
|
}
|
|
452
470
|
function getInstalledAppsList() {
|
|
453
|
-
callNative(getFuncName$
|
|
471
|
+
callNative(getFuncName$9('getInstalledAppsList'), null);
|
|
454
472
|
}
|
|
455
473
|
function execActionString(action) {
|
|
456
|
-
return callNative(getFuncName$
|
|
474
|
+
return callNative(getFuncName$9('execActionString'), action);
|
|
457
475
|
}
|
|
458
476
|
var app = {
|
|
459
477
|
getUserInfo: getUserInfo,
|
|
@@ -468,73 +486,73 @@ var app = {
|
|
|
468
486
|
execActionString: execActionString,
|
|
469
487
|
};
|
|
470
488
|
|
|
471
|
-
var moduleName$
|
|
472
|
-
function getFuncName$
|
|
473
|
-
return moduleName$
|
|
489
|
+
var moduleName$8 = 'system';
|
|
490
|
+
function getFuncName$8(name) {
|
|
491
|
+
return moduleName$8 + '_' + name;
|
|
474
492
|
}
|
|
475
493
|
// 告知宿主,小程序或者网页已经准备好
|
|
476
494
|
function ready() {
|
|
477
|
-
return callNative(getFuncName$
|
|
495
|
+
return callNative(getFuncName$8('ready'), null);
|
|
478
496
|
}
|
|
479
497
|
// 获取启动参数
|
|
480
498
|
function getStartupParams() {
|
|
481
|
-
return callNative(getFuncName$
|
|
499
|
+
return callNative(getFuncName$8('getStartupParams'), null);
|
|
482
500
|
}
|
|
483
501
|
// 获取设备信息
|
|
484
502
|
function getDeviceInfo() {
|
|
485
|
-
return callNative(getFuncName$
|
|
503
|
+
return callNative(getFuncName$8('getDeviceInfo'), null);
|
|
486
504
|
}
|
|
487
505
|
// 获取显示屏幕信息
|
|
488
506
|
function getDisplayInfo() {
|
|
489
|
-
return callNative(getFuncName$
|
|
507
|
+
return callNative(getFuncName$8('getDisplayInfo'), null);
|
|
490
508
|
}
|
|
491
509
|
// 获取 android property 的值
|
|
492
510
|
function getProperty(key) {
|
|
493
|
-
return callNative(getFuncName$
|
|
511
|
+
return callNative(getFuncName$8('getProperty'), { propName: key });
|
|
494
512
|
}
|
|
495
513
|
// 设置 android property 的值
|
|
496
514
|
function setProperty(key, value) {
|
|
497
|
-
return callNative(getFuncName$
|
|
515
|
+
return callNative(getFuncName$8('setProperty'), { propName: key, propValue: value });
|
|
498
516
|
}
|
|
499
517
|
// 检查 JS-API 是否已经实现
|
|
500
518
|
function checkApi(apiName) {
|
|
501
|
-
return callNative(getFuncName$
|
|
519
|
+
return callNative(getFuncName$8('checkApi'), { apiName: apiName });
|
|
502
520
|
}
|
|
503
521
|
// 获取本地字体的路径
|
|
504
522
|
function getFontPath(fontFileName) {
|
|
505
|
-
return callNative(getFuncName$
|
|
523
|
+
return callNative(getFuncName$8('getFontPath'), { fontFileName: fontFileName });
|
|
506
524
|
}
|
|
507
525
|
// 设置屏幕是否常亮
|
|
508
526
|
function setKeepScreenOn(enable) {
|
|
509
|
-
return callNative(getFuncName$
|
|
527
|
+
return callNative(getFuncName$8('setKeepScreenOn'), { enable: enable });
|
|
510
528
|
}
|
|
511
529
|
// 添加事件监听
|
|
512
530
|
function addEventListener$1(eventName, callback, options) {
|
|
513
531
|
if (options === void 0) { options = {}; }
|
|
514
|
-
return callWithPersistentCallBack(getFuncName$
|
|
532
|
+
return callWithPersistentCallBack(getFuncName$8('addEventListener'), { callbackId: eventName, options: options }, eventName, callback);
|
|
515
533
|
}
|
|
516
534
|
// 删除事件监听
|
|
517
535
|
function removeEventListener$1(eventName, callback, options) {
|
|
518
536
|
if (options === void 0) { options = {}; }
|
|
519
537
|
var ret = deletePersistentCallBack(eventName, callback);
|
|
520
538
|
if (ret) {
|
|
521
|
-
return callNative(getFuncName$
|
|
539
|
+
return callNative(getFuncName$8('removeEventListener'), { callbackId: eventName, options: options });
|
|
522
540
|
}
|
|
523
541
|
return new Promise(function (resolve) { resolve(); });
|
|
524
542
|
}
|
|
525
543
|
function sendBroadcast(params) {
|
|
526
|
-
return callNative(getFuncName$
|
|
544
|
+
return callNative(getFuncName$8('sendBroadcast'), params);
|
|
527
545
|
}
|
|
528
546
|
// 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
|
|
529
547
|
function registerKeys(params) {
|
|
530
|
-
return callNative(getFuncName$
|
|
548
|
+
return callNative(getFuncName$8('registerKeys'), params || { keys: [] });
|
|
531
549
|
}
|
|
532
550
|
// 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
|
|
533
551
|
function unregisterKeys(params) {
|
|
534
|
-
return callNative(getFuncName$
|
|
552
|
+
return callNative(getFuncName$8('unregisterKeys'), params || { keys: [] });
|
|
535
553
|
}
|
|
536
554
|
function providerCall(params) {
|
|
537
|
-
return callNative(getFuncName$
|
|
555
|
+
return callNative(getFuncName$8('providerCall'), params);
|
|
538
556
|
}
|
|
539
557
|
var system = {
|
|
540
558
|
ready: ready,
|
|
@@ -555,41 +573,41 @@ var system = {
|
|
|
555
573
|
//sendEvent
|
|
556
574
|
};
|
|
557
575
|
|
|
558
|
-
var moduleName$
|
|
559
|
-
function getFuncName$
|
|
560
|
-
return moduleName$
|
|
576
|
+
var moduleName$7 = 'storage';
|
|
577
|
+
function getFuncName$7(name) {
|
|
578
|
+
return moduleName$7 + '_' + name;
|
|
561
579
|
}
|
|
562
580
|
function setKey(key, value, namespace) {
|
|
563
581
|
if (namespace === void 0) { namespace = ''; }
|
|
564
|
-
return callNative(getFuncName$
|
|
582
|
+
return callNative(getFuncName$7('setKey'), { key: key, value: value, namespace: namespace });
|
|
565
583
|
}
|
|
566
584
|
function getKey(key, namespace) {
|
|
567
585
|
if (namespace === void 0) { namespace = ''; }
|
|
568
|
-
return callNative(getFuncName$
|
|
586
|
+
return callNative(getFuncName$7('getKey'), { key: key, namespace: namespace });
|
|
569
587
|
}
|
|
570
588
|
function deleteKey(key, namespace) {
|
|
571
589
|
if (namespace === void 0) { namespace = ''; }
|
|
572
|
-
return callNative(getFuncName$
|
|
590
|
+
return callNative(getFuncName$7('deleteKey'), { key: key, namespace: namespace });
|
|
573
591
|
}
|
|
574
592
|
function clearAllKeys(namespace) {
|
|
575
593
|
if (namespace === void 0) { namespace = ''; }
|
|
576
|
-
return callNative(getFuncName$
|
|
594
|
+
return callNative(getFuncName$7('clearAllKeys'), { namespace: namespace });
|
|
577
595
|
}
|
|
578
596
|
function setLargeKey(key, value, namespace) {
|
|
579
597
|
if (namespace === void 0) { namespace = ''; }
|
|
580
|
-
return callNative(getFuncName$
|
|
598
|
+
return callNative(getFuncName$7('setLargeKey'), { key: key, value: value, namespace: namespace });
|
|
581
599
|
}
|
|
582
600
|
function getLargeKey(key, namespace) {
|
|
583
601
|
if (namespace === void 0) { namespace = ''; }
|
|
584
|
-
return callNative(getFuncName$
|
|
602
|
+
return callNative(getFuncName$7('getLargeKey'), { key: key, namespace: namespace });
|
|
585
603
|
}
|
|
586
604
|
function deleteLargeKey(key, namespace) {
|
|
587
605
|
if (namespace === void 0) { namespace = ''; }
|
|
588
|
-
return callNative(getFuncName$
|
|
606
|
+
return callNative(getFuncName$7('deleteLargeKey'), { key: key, namespace: namespace });
|
|
589
607
|
}
|
|
590
608
|
function clearAllLargeKey(namespace) {
|
|
591
609
|
if (namespace === void 0) { namespace = ''; }
|
|
592
|
-
return callNative(getFuncName$
|
|
610
|
+
return callNative(getFuncName$7('clearAllLargeKey'), { namespace: namespace });
|
|
593
611
|
}
|
|
594
612
|
var storage = {
|
|
595
613
|
setKey: setKey,
|
|
@@ -602,54 +620,54 @@ var storage = {
|
|
|
602
620
|
clearAllLargeKey: clearAllLargeKey,
|
|
603
621
|
};
|
|
604
622
|
|
|
605
|
-
var moduleName$
|
|
606
|
-
function getFuncName$
|
|
607
|
-
return moduleName$
|
|
623
|
+
var moduleName$6 = 'audio';
|
|
624
|
+
function getFuncName$6(name) {
|
|
625
|
+
return moduleName$6 + '_' + name;
|
|
608
626
|
}
|
|
609
627
|
// 播放器,播放新的URL或者本地文件系统的路径
|
|
610
628
|
function playNew(path) {
|
|
611
|
-
return callNative(getFuncName$
|
|
629
|
+
return callNative(getFuncName$6('playNew'), { path: path });
|
|
612
630
|
}
|
|
613
631
|
// 播放器,停止播放
|
|
614
632
|
function stop$1() {
|
|
615
|
-
return callNative(getFuncName$
|
|
633
|
+
return callNative(getFuncName$6('stop'), null);
|
|
616
634
|
}
|
|
617
635
|
// 播放器,是否正在播放中
|
|
618
636
|
function isPlaying$1() {
|
|
619
|
-
return callNative(getFuncName$
|
|
637
|
+
return callNative(getFuncName$6('isPlaying'), null);
|
|
620
638
|
}
|
|
621
639
|
// 播放器,是否准备好
|
|
622
640
|
function hasPrepared$1() {
|
|
623
|
-
return callNative(getFuncName$
|
|
641
|
+
return callNative(getFuncName$6('hasPrepared'), null);
|
|
624
642
|
}
|
|
625
643
|
// 播放器,获取总时长
|
|
626
644
|
function getDuration$1() {
|
|
627
|
-
return callNative(getFuncName$
|
|
645
|
+
return callNative(getFuncName$6('getDuration'), null);
|
|
628
646
|
}
|
|
629
647
|
// 播放器,获取当前进度值
|
|
630
648
|
function getCurrentPosition$1() {
|
|
631
|
-
return callNative(getFuncName$
|
|
649
|
+
return callNative(getFuncName$6('getCurrentPosition'), null);
|
|
632
650
|
}
|
|
633
651
|
// 播放器,获取播放状态,返回的value为字符串来标识播放状态
|
|
634
652
|
// 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
|
|
635
653
|
function getPlayerState$1() {
|
|
636
|
-
return callNative(getFuncName$
|
|
654
|
+
return callNative(getFuncName$6('getPlayerState'), null);
|
|
637
655
|
}
|
|
638
656
|
// 播放器,暂停播放
|
|
639
657
|
function pause$1() {
|
|
640
|
-
return callNative(getFuncName$
|
|
658
|
+
return callNative(getFuncName$6('pause'), null);
|
|
641
659
|
}
|
|
642
660
|
// 播放器,启动播放或者从暂停恢复播放
|
|
643
661
|
function start$1() {
|
|
644
|
-
return callNative(getFuncName$
|
|
662
|
+
return callNative(getFuncName$6('start'), null);
|
|
645
663
|
}
|
|
646
664
|
// 播放器,重新播放
|
|
647
665
|
function rePlay$1() {
|
|
648
|
-
return callNative(getFuncName$
|
|
666
|
+
return callNative(getFuncName$6('rePlay'), null);
|
|
649
667
|
}
|
|
650
668
|
// 播放器,seek
|
|
651
669
|
function seekTo$1(position) {
|
|
652
|
-
return callNative(getFuncName$
|
|
670
|
+
return callNative(getFuncName$6('seekTo'), { position: Math.floor(position) });
|
|
653
671
|
}
|
|
654
672
|
// 播放器,设置单片循环模式
|
|
655
673
|
// isLooping: 是否循环播放
|
|
@@ -657,16 +675,16 @@ function seekTo$1(position) {
|
|
|
657
675
|
// 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
|
|
658
676
|
function setLooping$1(isLooping, silentLoop) {
|
|
659
677
|
if (silentLoop === void 0) { silentLoop = false; }
|
|
660
|
-
return callNative(getFuncName$
|
|
678
|
+
return callNative(getFuncName$6('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
|
|
661
679
|
}
|
|
662
680
|
// 设置音量
|
|
663
681
|
function setVolume(volume) {
|
|
664
|
-
return callNative(getFuncName$
|
|
682
|
+
return callNative(getFuncName$6('setVolume'), { volume: volume });
|
|
665
683
|
}
|
|
666
684
|
// 设置播放内核
|
|
667
685
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
668
686
|
function setPlayerCore$1(core) {
|
|
669
|
-
return callNative(getFuncName$
|
|
687
|
+
return callNative(getFuncName$6('setPlayerCore'), { core: core });
|
|
670
688
|
}
|
|
671
689
|
var audio = {
|
|
672
690
|
playNew: playNew,
|
|
@@ -685,62 +703,62 @@ var audio = {
|
|
|
685
703
|
setPlayerCore: setPlayerCore$1,
|
|
686
704
|
};
|
|
687
705
|
|
|
688
|
-
var moduleName$
|
|
689
|
-
function getFuncName$
|
|
690
|
-
return moduleName$
|
|
706
|
+
var moduleName$5 = 'video';
|
|
707
|
+
function getFuncName$5(name) {
|
|
708
|
+
return moduleName$5 + '_' + name;
|
|
691
709
|
}
|
|
692
710
|
// 设置视频播放窗口的位置与宽高
|
|
693
711
|
function setVideoLayout(width, height, x, y) {
|
|
694
|
-
return callNative(getFuncName$
|
|
712
|
+
return callNative(getFuncName$5('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
|
|
695
713
|
}
|
|
696
714
|
// 设置视频窗口是否显示
|
|
697
715
|
function setVideoVisible(show) {
|
|
698
|
-
return callNative(getFuncName$
|
|
716
|
+
return callNative(getFuncName$5('setVideoVisible'), { visible: show });
|
|
699
717
|
}
|
|
700
718
|
// 播放器,播放新的URL
|
|
701
719
|
function playNewUrl(url) {
|
|
702
|
-
return callNative(getFuncName$
|
|
720
|
+
return callNative(getFuncName$5('playNewUrl'), { url: url });
|
|
703
721
|
}
|
|
704
722
|
// 播放器,播放新的本地文件路径
|
|
705
723
|
function playNewFile(path) {
|
|
706
|
-
return callNative(getFuncName$
|
|
724
|
+
return callNative(getFuncName$5('playNewFile'), { path: path });
|
|
707
725
|
}
|
|
708
726
|
// 播放器,停止播放
|
|
709
727
|
function stop() {
|
|
710
|
-
return callNative(getFuncName$
|
|
728
|
+
return callNative(getFuncName$5('stop'), null);
|
|
711
729
|
}
|
|
712
730
|
// 播放器,暂停播放
|
|
713
731
|
function pause() {
|
|
714
|
-
return callNative(getFuncName$
|
|
732
|
+
return callNative(getFuncName$5('pause'), null);
|
|
715
733
|
}
|
|
716
734
|
// 播放器,启动播放或者从暂停恢复播放
|
|
717
735
|
function start() {
|
|
718
|
-
return callNative(getFuncName$
|
|
736
|
+
return callNative(getFuncName$5('start'), null);
|
|
719
737
|
}
|
|
720
738
|
// 播放器,seek
|
|
721
739
|
function seekTo(position) {
|
|
722
|
-
return callNative(getFuncName$
|
|
740
|
+
return callNative(getFuncName$5('seekTo'), { position: Math.floor(position) });
|
|
723
741
|
}
|
|
724
742
|
// 播放器,是否准备好
|
|
725
743
|
function hasPrepared() {
|
|
726
|
-
return callNative(getFuncName$
|
|
744
|
+
return callNative(getFuncName$5('hasPrepared'), null);
|
|
727
745
|
}
|
|
728
746
|
// 播放器,是否正在播放中
|
|
729
747
|
function isPlaying() {
|
|
730
|
-
return callNative(getFuncName$
|
|
748
|
+
return callNative(getFuncName$5('isPlaying'), null);
|
|
731
749
|
}
|
|
732
750
|
// 播放器,获取总时长
|
|
733
751
|
function getDuration() {
|
|
734
|
-
return callNative(getFuncName$
|
|
752
|
+
return callNative(getFuncName$5('getDuration'), null);
|
|
735
753
|
}
|
|
736
754
|
// 播放器,获取当前进度值
|
|
737
755
|
function getCurrentPosition() {
|
|
738
|
-
return callNative(getFuncName$
|
|
756
|
+
return callNative(getFuncName$5('getCurrentPosition'), null);
|
|
739
757
|
}
|
|
740
758
|
// 播放器,获取播放状态,返回的value为字符串来标识播放状态
|
|
741
759
|
// 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
|
|
742
760
|
function getPlayerState() {
|
|
743
|
-
return callNative(getFuncName$
|
|
761
|
+
return callNative(getFuncName$5('getPlayerState'), null);
|
|
744
762
|
}
|
|
745
763
|
// 播放器,设置单片循环模式
|
|
746
764
|
// isLooping: 是否循环播放
|
|
@@ -748,40 +766,40 @@ function getPlayerState() {
|
|
|
748
766
|
// 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
|
|
749
767
|
function setLooping(isLooping, silentLoop) {
|
|
750
768
|
if (silentLoop === void 0) { silentLoop = false; }
|
|
751
|
-
return callNative(getFuncName$
|
|
769
|
+
return callNative(getFuncName$5('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
|
|
752
770
|
}
|
|
753
771
|
// 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
|
|
754
772
|
function setAutoWakeLock(autoWakeLock) {
|
|
755
|
-
return callNative(getFuncName$
|
|
773
|
+
return callNative(getFuncName$5('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
|
|
756
774
|
}
|
|
757
775
|
// 播放器,重新播放
|
|
758
776
|
function rePlay() {
|
|
759
|
-
return callNative(getFuncName$
|
|
777
|
+
return callNative(getFuncName$5('rePlay'), null);
|
|
760
778
|
}
|
|
761
779
|
// 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
|
|
762
780
|
function setPlayWhenReady(playWhenReady) {
|
|
763
781
|
if (playWhenReady === void 0) { playWhenReady = true; }
|
|
764
|
-
return callNative(getFuncName$
|
|
782
|
+
return callNative(getFuncName$5('setPlayWhenReady'), { playWhenReady: playWhenReady });
|
|
765
783
|
}
|
|
766
784
|
// 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
|
|
767
785
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
768
786
|
function getPlayerCore() {
|
|
769
|
-
return callNative(getFuncName$
|
|
787
|
+
return callNative(getFuncName$5('getPlayerCore'), null);
|
|
770
788
|
}
|
|
771
789
|
// 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
|
|
772
790
|
// 值: MediaPlayer, SocPlayer, ExoPlayer
|
|
773
791
|
function getRealPlayerCore() {
|
|
774
|
-
return callNative(getFuncName$
|
|
792
|
+
return callNative(getFuncName$5('getRealPlayerCore'), null);
|
|
775
793
|
}
|
|
776
794
|
// 设置播放内核
|
|
777
795
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
778
796
|
function setPlayerCore(core) {
|
|
779
|
-
return callNative(getFuncName$
|
|
797
|
+
return callNative(getFuncName$5('setPlayerCore'), { core: core });
|
|
780
798
|
}
|
|
781
799
|
// 设置渲染模式
|
|
782
800
|
// 值: SurfaceView, TextureView
|
|
783
801
|
function setRenderType(playerRender) {
|
|
784
|
-
return callNative(getFuncName$
|
|
802
|
+
return callNative(getFuncName$5('setRenderType'), { playerRender: playerRender });
|
|
785
803
|
}
|
|
786
804
|
var video = {
|
|
787
805
|
setVideoLayout: setVideoLayout,
|
|
@@ -807,9 +825,9 @@ var video = {
|
|
|
807
825
|
setRenderType: setRenderType,
|
|
808
826
|
};
|
|
809
827
|
|
|
810
|
-
var moduleName$
|
|
811
|
-
function getFuncName$
|
|
812
|
-
return moduleName$
|
|
828
|
+
var moduleName$4 = 'fs';
|
|
829
|
+
function getFuncName$4(name) {
|
|
830
|
+
return moduleName$4 + '_' + name;
|
|
813
831
|
}
|
|
814
832
|
// 读取文件并返回文件的所有内容
|
|
815
833
|
// 参数:
|
|
@@ -817,7 +835,7 @@ function getFuncName$3(name) {
|
|
|
817
835
|
// base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
|
|
818
836
|
function readAllContent(path, base64Flag) {
|
|
819
837
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
820
|
-
return callNative(getFuncName$
|
|
838
|
+
return callNative(getFuncName$4('readAllContent'), { path: path, base64Flag: base64Flag });
|
|
821
839
|
}
|
|
822
840
|
// 将内容全部写入文件
|
|
823
841
|
// 参数:
|
|
@@ -826,114 +844,114 @@ function readAllContent(path, base64Flag) {
|
|
|
826
844
|
// base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
|
|
827
845
|
function writeAllContent(path, content, base64Flag) {
|
|
828
846
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
829
|
-
return callNative(getFuncName$
|
|
847
|
+
return callNative(getFuncName$4('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
|
|
830
848
|
}
|
|
831
849
|
// 获取应用基本目录的全路径名
|
|
832
850
|
function getAppBaseDir() {
|
|
833
|
-
return callNative(getFuncName$
|
|
851
|
+
return callNative(getFuncName$4('getAppBaseDir'), null);
|
|
834
852
|
}
|
|
835
853
|
// 获取 Cache 目录的全路径名
|
|
836
854
|
function getAppCacheDir() {
|
|
837
|
-
return callNative(getFuncName$
|
|
855
|
+
return callNative(getFuncName$4('getAppCacheDir'), null);
|
|
838
856
|
}
|
|
839
857
|
// 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
|
|
840
858
|
// 参数:
|
|
841
859
|
// fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
|
|
842
860
|
function makeCacheFile(fileName) {
|
|
843
861
|
if (fileName === void 0) { fileName = ''; }
|
|
844
|
-
return callNative(getFuncName$
|
|
862
|
+
return callNative(getFuncName$4('makeCacheFile'), { fileName: fileName });
|
|
845
863
|
}
|
|
846
864
|
// 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
|
|
847
865
|
// 参数:
|
|
848
866
|
// fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
|
|
849
867
|
function makeNormalFile(fileName) {
|
|
850
868
|
if (fileName === void 0) { fileName = ''; }
|
|
851
|
-
return callNative(getFuncName$
|
|
869
|
+
return callNative(getFuncName$4('makeNormalFile'), { fileName: fileName });
|
|
852
870
|
}
|
|
853
871
|
// 检测一个文件或者目录是否存在
|
|
854
872
|
// 参数:
|
|
855
873
|
// path: 指定路径
|
|
856
874
|
function exists(path) {
|
|
857
|
-
return callNative(getFuncName$
|
|
875
|
+
return callNative(getFuncName$4('exists'), { path: path });
|
|
858
876
|
}
|
|
859
877
|
// 检测一个路径是否为一个普通文件
|
|
860
878
|
// 参数:
|
|
861
879
|
// path: 指定路径
|
|
862
880
|
function isFile(path) {
|
|
863
|
-
return callNative(getFuncName$
|
|
881
|
+
return callNative(getFuncName$4('isFile'), { path: path });
|
|
864
882
|
}
|
|
865
883
|
// 检测一个路径是否为一个目录
|
|
866
884
|
// 参数:
|
|
867
885
|
// path: 指定路径
|
|
868
886
|
function isDirectory(path) {
|
|
869
|
-
return callNative(getFuncName$
|
|
887
|
+
return callNative(getFuncName$4('isDirectory'), { path: path });
|
|
870
888
|
}
|
|
871
889
|
// 检测一个路径表示的文件或目录 是否是隐藏的
|
|
872
890
|
// 参数:
|
|
873
891
|
// path: 指定路径
|
|
874
892
|
function isHidden(path) {
|
|
875
|
-
return callNative(getFuncName$
|
|
893
|
+
return callNative(getFuncName$4('isHidden'), { path: path });
|
|
876
894
|
}
|
|
877
895
|
// 检测一个路径表示的文件或目录 是否可读
|
|
878
896
|
// 参数:
|
|
879
897
|
// path: 指定路径
|
|
880
898
|
function canRead(path) {
|
|
881
|
-
return callNative(getFuncName$
|
|
899
|
+
return callNative(getFuncName$4('canRead'), { path: path });
|
|
882
900
|
}
|
|
883
901
|
// 检测一个路径表示的文件或目录 是否可写
|
|
884
902
|
// 参数:
|
|
885
903
|
// path: 指定路径
|
|
886
904
|
function canWrite(path) {
|
|
887
|
-
return callNative(getFuncName$
|
|
905
|
+
return callNative(getFuncName$4('canWrite'), { path: path });
|
|
888
906
|
}
|
|
889
907
|
// 检测一个路径表示的文件或目录 是否可执行
|
|
890
908
|
// 参数:
|
|
891
909
|
// path: 指定路径
|
|
892
910
|
function canExecute(path) {
|
|
893
|
-
return callNative(getFuncName$
|
|
911
|
+
return callNative(getFuncName$4('canExecute'), { path: path });
|
|
894
912
|
}
|
|
895
913
|
// 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
|
|
896
914
|
// 参数:
|
|
897
915
|
// path: 指定路径
|
|
898
916
|
function lastModified(path) {
|
|
899
|
-
return callNative(getFuncName$
|
|
917
|
+
return callNative(getFuncName$4('lastModified'), { path: path });
|
|
900
918
|
}
|
|
901
919
|
// 删除文件
|
|
902
920
|
// 参数:
|
|
903
921
|
// path: 指定路径
|
|
904
922
|
function deleteIt(path) {
|
|
905
|
-
return callNative(getFuncName$
|
|
923
|
+
return callNative(getFuncName$4('delete'), { path: path });
|
|
906
924
|
}
|
|
907
925
|
// 新建目录
|
|
908
926
|
// 参数:
|
|
909
927
|
// path: 指定路径
|
|
910
928
|
function mkdir(path) {
|
|
911
|
-
return callNative(getFuncName$
|
|
929
|
+
return callNative(getFuncName$4('mkdir'), { path: path });
|
|
912
930
|
}
|
|
913
931
|
// 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
|
|
914
932
|
// 参数:
|
|
915
933
|
// path: 指定路径
|
|
916
934
|
function mkdirs(path) {
|
|
917
|
-
return callNative(getFuncName$
|
|
935
|
+
return callNative(getFuncName$4('mkdirs'), { path: path });
|
|
918
936
|
}
|
|
919
937
|
// 改名
|
|
920
938
|
// 参数:
|
|
921
939
|
// from: 指定源路径
|
|
922
940
|
// to: 指定目标路径
|
|
923
941
|
function rename(from, to) {
|
|
924
|
-
return callNative(getFuncName$
|
|
942
|
+
return callNative(getFuncName$4('rename'), { from: from, to: to });
|
|
925
943
|
}
|
|
926
944
|
// 将相对路径的转换为全路径
|
|
927
945
|
// 参数:
|
|
928
946
|
// path: 指定路径
|
|
929
947
|
function getAbsolutePath(path) {
|
|
930
|
-
return callNative(getFuncName$
|
|
948
|
+
return callNative(getFuncName$4('getAbsolutePath'), { path: path });
|
|
931
949
|
}
|
|
932
950
|
// 指定路径创建新文件
|
|
933
951
|
// 参数:
|
|
934
952
|
// path: 指定路径
|
|
935
953
|
function createNewFile(path) {
|
|
936
|
-
return callNative(getFuncName$
|
|
954
|
+
return callNative(getFuncName$4('createNewFile'), { path: path });
|
|
937
955
|
}
|
|
938
956
|
// 设置可读属性
|
|
939
957
|
// 参数:
|
|
@@ -941,7 +959,7 @@ function createNewFile(path) {
|
|
|
941
959
|
// value: 是否可读
|
|
942
960
|
function setReadable(path, value) {
|
|
943
961
|
if (value === void 0) { value = true; }
|
|
944
|
-
return callNative(getFuncName$
|
|
962
|
+
return callNative(getFuncName$4('setReadable'), { path: path, value: value });
|
|
945
963
|
}
|
|
946
964
|
// 设置可写属性
|
|
947
965
|
// 参数:
|
|
@@ -949,7 +967,7 @@ function setReadable(path, value) {
|
|
|
949
967
|
// value: 是否可写
|
|
950
968
|
function setWritable(path, value) {
|
|
951
969
|
if (value === void 0) { value = true; }
|
|
952
|
-
return callNative(getFuncName$
|
|
970
|
+
return callNative(getFuncName$4('setWritable'), { path: path, value: value });
|
|
953
971
|
}
|
|
954
972
|
// 设置可执行属性
|
|
955
973
|
// 参数:
|
|
@@ -957,7 +975,7 @@ function setWritable(path, value) {
|
|
|
957
975
|
// value: 是否可执行
|
|
958
976
|
function setExecutable(path, value) {
|
|
959
977
|
if (value === void 0) { value = true; }
|
|
960
|
-
return callNative(getFuncName$
|
|
978
|
+
return callNative(getFuncName$4('setExecutable'), { path: path, value: value });
|
|
961
979
|
}
|
|
962
980
|
// 设置文件最后修改的时间
|
|
963
981
|
// 参数:
|
|
@@ -965,13 +983,13 @@ function setExecutable(path, value) {
|
|
|
965
983
|
// value: 时间戳
|
|
966
984
|
function setLastModified(path, value) {
|
|
967
985
|
if (value === void 0) { value = 0; }
|
|
968
|
-
return callNative(getFuncName$
|
|
986
|
+
return callNative(getFuncName$4('setLastModified'), { path: path, value: value });
|
|
969
987
|
}
|
|
970
988
|
// 读取目录,返回该目录下的文件列表
|
|
971
989
|
// 参数:
|
|
972
990
|
// path: 指定路径
|
|
973
991
|
function list(path) {
|
|
974
|
-
return callNative(getFuncName$
|
|
992
|
+
return callNative(getFuncName$4('list'), { path: path });
|
|
975
993
|
}
|
|
976
994
|
// 打开只读文件流
|
|
977
995
|
// 参数:
|
|
@@ -979,7 +997,7 @@ function list(path) {
|
|
|
979
997
|
// 返回:
|
|
980
998
|
// streamId: 流的ID
|
|
981
999
|
function openInputStream(path) {
|
|
982
|
-
return callNative(getFuncName$
|
|
1000
|
+
return callNative(getFuncName$4('openInputStream'), { path: path });
|
|
983
1001
|
}
|
|
984
1002
|
// 打开只写文件流
|
|
985
1003
|
// 参数:
|
|
@@ -987,13 +1005,13 @@ function openInputStream(path) {
|
|
|
987
1005
|
// 返回:
|
|
988
1006
|
// streamId: 流的ID
|
|
989
1007
|
function openOutputStream(path) {
|
|
990
|
-
return callNative(getFuncName$
|
|
1008
|
+
return callNative(getFuncName$4('openOutputStream'), { path: path });
|
|
991
1009
|
}
|
|
992
1010
|
// 关闭文件流(可以是只读流,也可以是只写流)
|
|
993
1011
|
// 参数:
|
|
994
1012
|
// streamId: 流的ID
|
|
995
1013
|
function closeStream(streamId) {
|
|
996
|
-
return callNative(getFuncName$
|
|
1014
|
+
return callNative(getFuncName$4('closeStream'), { streamId: streamId });
|
|
997
1015
|
}
|
|
998
1016
|
// 读取文件流的内容
|
|
999
1017
|
// 参数:
|
|
@@ -1002,7 +1020,7 @@ function closeStream(streamId) {
|
|
|
1002
1020
|
// base64Flag: 是否以base64的形式返回(默认以普通字符串的形式返回,如果读取二进制文件,则应该设置为以base64的形式返回)
|
|
1003
1021
|
function readStream(streamId, size, base64Flag) {
|
|
1004
1022
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
1005
|
-
return callNative(getFuncName$
|
|
1023
|
+
return callNative(getFuncName$4('readStream'), { streamId: streamId, size: size, base64Flag: base64Flag });
|
|
1006
1024
|
}
|
|
1007
1025
|
// 将内容写入文件流
|
|
1008
1026
|
// 参数:
|
|
@@ -1011,7 +1029,7 @@ function readStream(streamId, size, base64Flag) {
|
|
|
1011
1029
|
// base64Flag: 是否以base64的形式传递要写入的内容(默认写入普通字符串的文本,如果要写入二进制数据,则应该设置为以base64的形式的内容)
|
|
1012
1030
|
function writeStream(streamId, content, base64Flag) {
|
|
1013
1031
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
1014
|
-
return callNative(getFuncName$
|
|
1032
|
+
return callNative(getFuncName$4('writeStream'), { streamId: streamId, content: content, base64Flag: base64Flag });
|
|
1015
1033
|
}
|
|
1016
1034
|
var fs = {
|
|
1017
1035
|
readAllContent: readAllContent,
|
|
@@ -1046,19 +1064,19 @@ var fs = {
|
|
|
1046
1064
|
writeStream: writeStream,
|
|
1047
1065
|
};
|
|
1048
1066
|
|
|
1049
|
-
var moduleName$
|
|
1050
|
-
function getFuncName$
|
|
1051
|
-
return moduleName$
|
|
1067
|
+
var moduleName$3 = 'pag';
|
|
1068
|
+
function getFuncName$3(name) {
|
|
1069
|
+
return moduleName$3 + '_' + name;
|
|
1052
1070
|
}
|
|
1053
1071
|
// 播放PAG动画
|
|
1054
1072
|
// repeat: 循环次数 -1 表示无限
|
|
1055
1073
|
//
|
|
1056
1074
|
function startNewPagAni(params) {
|
|
1057
|
-
return callNative(getFuncName$
|
|
1075
|
+
return callNative(getFuncName$3('startNewPagAni'), params);
|
|
1058
1076
|
}
|
|
1059
1077
|
// 停止PAG动画,并消失
|
|
1060
1078
|
function stopPagAni() {
|
|
1061
|
-
return callNative(getFuncName$
|
|
1079
|
+
return callNative(getFuncName$3('stopPagAni'), null);
|
|
1062
1080
|
}
|
|
1063
1081
|
function setPagVisibility(visible) {
|
|
1064
1082
|
if (visible === void 0) { visible = true; }
|
|
@@ -1075,10 +1093,10 @@ function setPagVisibility(visible) {
|
|
|
1075
1093
|
else {
|
|
1076
1094
|
value = visible;
|
|
1077
1095
|
}
|
|
1078
|
-
return callNative(getFuncName$
|
|
1096
|
+
return callNative(getFuncName$3('setPagVisibility'), { visible: value });
|
|
1079
1097
|
}
|
|
1080
1098
|
function setPagXY(x, y) {
|
|
1081
|
-
return callNative(getFuncName$
|
|
1099
|
+
return callNative(getFuncName$3('setPagXY'), { x: x, y: y });
|
|
1082
1100
|
}
|
|
1083
1101
|
// // 播报 TTS 文本语音
|
|
1084
1102
|
// export function sendTts(text: string, ttsId: string): Promise<any> {
|
|
@@ -1121,64 +1139,64 @@ var pag = {
|
|
|
1121
1139
|
// clearBackground,
|
|
1122
1140
|
};
|
|
1123
1141
|
|
|
1124
|
-
var moduleName$
|
|
1125
|
-
function getFuncName$
|
|
1126
|
-
return moduleName$
|
|
1142
|
+
var moduleName$2 = 'voice';
|
|
1143
|
+
function getFuncName$2(name) {
|
|
1144
|
+
return moduleName$2 + '_' + name;
|
|
1127
1145
|
}
|
|
1128
1146
|
// 开启语音输入
|
|
1129
1147
|
function enableVoiceInput(clientId, parameters, expandedParameters) {
|
|
1130
1148
|
if (clientId === void 0) { clientId = ''; }
|
|
1131
1149
|
if (parameters === void 0) { parameters = {}; }
|
|
1132
1150
|
if (expandedParameters === void 0) { expandedParameters = {}; }
|
|
1133
|
-
return callNative(getFuncName$
|
|
1151
|
+
return callNative(getFuncName$2('enableVoiceInput'), { clientId: clientId, parameters: parameters, expandedParameters: expandedParameters });
|
|
1134
1152
|
}
|
|
1135
1153
|
// 关闭语音输入
|
|
1136
1154
|
function disableVoiceInput() {
|
|
1137
|
-
return callNative(getFuncName$
|
|
1155
|
+
return callNative(getFuncName$2('disableVoiceInput'), {});
|
|
1138
1156
|
}
|
|
1139
1157
|
// 开启意图识别指令返回
|
|
1140
1158
|
function enableDirective(enable) {
|
|
1141
1159
|
if (enable === void 0) { enable = true; }
|
|
1142
|
-
return callNative(getFuncName$
|
|
1160
|
+
return callNative(getFuncName$2('enableDirective'), { enable: enable });
|
|
1143
1161
|
}
|
|
1144
1162
|
// 开启意图识别指令返回
|
|
1145
1163
|
function setDirective(enable) {
|
|
1146
1164
|
if (enable === void 0) { enable = true; }
|
|
1147
|
-
return callNative(getFuncName$
|
|
1165
|
+
return callNative(getFuncName$2('setDirective'), { enable: enable });
|
|
1148
1166
|
}
|
|
1149
1167
|
// 开启录音功能
|
|
1150
1168
|
function enableRecording() {
|
|
1151
|
-
return callNative(getFuncName$
|
|
1169
|
+
return callNative(getFuncName$2('enableRecording'), {});
|
|
1152
1170
|
}
|
|
1153
1171
|
// 关闭录音功能
|
|
1154
1172
|
function disableRecording() {
|
|
1155
|
-
return callNative(getFuncName$
|
|
1173
|
+
return callNative(getFuncName$2('disableRecording'), {});
|
|
1156
1174
|
}
|
|
1157
1175
|
// 停止TTS播报
|
|
1158
1176
|
//
|
|
1159
1177
|
function stopTts$1() {
|
|
1160
|
-
return callNative(getFuncName$
|
|
1178
|
+
return callNative(getFuncName$2('stopTts'), {});
|
|
1161
1179
|
}
|
|
1162
1180
|
// 开始 TTS 播报
|
|
1163
1181
|
function sendTts$1(text, ttsId) {
|
|
1164
|
-
return callNative(getFuncName$
|
|
1182
|
+
return callNative(getFuncName$2('sendTts'), { text: text, ttsId: ttsId });
|
|
1165
1183
|
}
|
|
1166
1184
|
// 流式播报 TTS
|
|
1167
1185
|
function sendStreamTts$1(text, ttsId, isFirst, isEnd) {
|
|
1168
|
-
return callNative(getFuncName$
|
|
1186
|
+
return callNative(getFuncName$2('sendStreamTts'), { text: text, ttsId: ttsId, isFirst: isFirst, isEnd: isEnd });
|
|
1169
1187
|
}
|
|
1170
1188
|
// 设置播放TTS的人声
|
|
1171
1189
|
function setTtsSpeaker(speaker) {
|
|
1172
|
-
return callNative(getFuncName$
|
|
1190
|
+
return callNative(getFuncName$2('setTtsSpeaker'), { speaker: speaker });
|
|
1173
1191
|
}
|
|
1174
1192
|
// 发送纯文本
|
|
1175
1193
|
function sendVoiceTextToAI(text) {
|
|
1176
|
-
return callNative(getFuncName$
|
|
1194
|
+
return callNative(getFuncName$2('sendVoiceTextToAI'), { text: text });
|
|
1177
1195
|
}
|
|
1178
1196
|
// 开启意图识别指令返回
|
|
1179
1197
|
function setA2UI(enable) {
|
|
1180
1198
|
if (enable === void 0) { enable = true; }
|
|
1181
|
-
return callNative(getFuncName$
|
|
1199
|
+
return callNative(getFuncName$2('setA2UI'), { enable: enable });
|
|
1182
1200
|
}
|
|
1183
1201
|
var voice = {
|
|
1184
1202
|
enableVoiceInput: enableVoiceInput,
|
|
@@ -1214,6 +1232,25 @@ var event = {
|
|
|
1214
1232
|
removeEventListener: removeEventListener,
|
|
1215
1233
|
};
|
|
1216
1234
|
|
|
1235
|
+
var moduleName$1 = 'log';
|
|
1236
|
+
function getFuncName$1(name) {
|
|
1237
|
+
return moduleName$1 + '_' + name;
|
|
1238
|
+
}
|
|
1239
|
+
function init$1(logInitInfo) {
|
|
1240
|
+
return callNative(getFuncName$1('init'), logInitInfo);
|
|
1241
|
+
}
|
|
1242
|
+
function submit(logData) {
|
|
1243
|
+
return callNative(getFuncName$1('submit'), logData);
|
|
1244
|
+
}
|
|
1245
|
+
function submitToByte(logData) {
|
|
1246
|
+
return callNative(getFuncName$1('submitToByte'), logData);
|
|
1247
|
+
}
|
|
1248
|
+
var log = {
|
|
1249
|
+
init: init$1,
|
|
1250
|
+
submit: submit,
|
|
1251
|
+
submitToByte: submitToByte,
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1217
1254
|
var moduleName = 'tts';
|
|
1218
1255
|
function getFuncName(name) {
|
|
1219
1256
|
return moduleName + '_' + name;
|
|
@@ -1275,10 +1312,17 @@ function apkNativeCallJs(str) {
|
|
|
1275
1312
|
function isRunInAppBrowser() {
|
|
1276
1313
|
return window['_liteNativeApi'] ? true : false;
|
|
1277
1314
|
}
|
|
1278
|
-
function init() {
|
|
1315
|
+
function init(nativeObject, nativeType) {
|
|
1316
|
+
if (nativeObject === void 0) { nativeObject = null; }
|
|
1317
|
+
if (nativeType === void 0) { nativeType = ''; }
|
|
1279
1318
|
if (window['_liteNativeApi']) {
|
|
1280
1319
|
window['appNativeCall'] = apkNativeCallJs;
|
|
1281
1320
|
}
|
|
1321
|
+
else if (window['CoocaaJsApiBridge']) ;
|
|
1322
|
+
else if (nativeObject) {
|
|
1323
|
+
setNativeObject(nativeObject, nativeType);
|
|
1324
|
+
window['appNativeCall'] = apkNativeCallJs;
|
|
1325
|
+
}
|
|
1282
1326
|
initSDK();
|
|
1283
1327
|
}
|
|
1284
1328
|
init();
|
|
@@ -1293,6 +1337,7 @@ var index = {
|
|
|
1293
1337
|
pag: pag,
|
|
1294
1338
|
voice: voice,
|
|
1295
1339
|
event: event,
|
|
1340
|
+
log: log,
|
|
1296
1341
|
fs: fs,
|
|
1297
1342
|
tts: tts,
|
|
1298
1343
|
apkNativeCallJs: apkNativeCallJs,
|
package/lib/core/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function onCommandFromApp(cmd: string, payload: string): void;
|
|
2
2
|
export declare function setAppCommandCallback(cb: Function): void;
|
|
3
3
|
export declare function unsetAppCommandCallback(): void;
|
|
4
|
+
export declare function setNativeObject(obj: any, _type: string): void;
|
|
4
5
|
export declare function callNative(funcName: string, params: any): Promise<any>;
|
|
5
6
|
export declare function callWithPersistentCallBack(funcName: string, params: any, persistentIdName: string, callback: Function): Promise<any>;
|
|
6
7
|
export declare function deletePersistentCallBack(persistentIdName: string, callback: Function): boolean;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { setAppCommandCallback, unsetAppCommandCallback } from './core';
|
|
2
2
|
export declare function apkNativeCallJs(str: string | object): void;
|
|
3
3
|
export declare function isRunInAppBrowser(): boolean;
|
|
4
|
-
export declare function init(): void;
|
|
4
|
+
export declare function init(nativeObject?: any, nativeType?: string): void;
|
|
5
5
|
declare const _default: {
|
|
6
6
|
init: typeof init;
|
|
7
7
|
network: {
|
|
@@ -116,6 +116,11 @@ declare const _default: {
|
|
|
116
116
|
addEventListener: typeof import("./event").addEventListener;
|
|
117
117
|
removeEventListener: typeof import("./event").removeEventListener;
|
|
118
118
|
};
|
|
119
|
+
log: {
|
|
120
|
+
init: typeof import("./log").init;
|
|
121
|
+
submit: typeof import("./log").submit;
|
|
122
|
+
submitToByte: typeof import("./log").submitToByte;
|
|
123
|
+
};
|
|
119
124
|
fs: {
|
|
120
125
|
readAllContent: typeof import("./file").readAllContent;
|
|
121
126
|
writeAllContent: typeof import("./file").writeAllContent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LogInitInfo {
|
|
2
|
+
appId?: string;
|
|
3
|
+
channel?: string;
|
|
4
|
+
productId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LogData {
|
|
7
|
+
eventName: string;
|
|
8
|
+
data?: any;
|
|
9
|
+
productId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function init(logInitInfo: LogInitInfo): Promise<any>;
|
|
12
|
+
export declare function submit(logData: LogData): Promise<any>;
|
|
13
|
+
export declare function submitToByte(logData: LogData): Promise<any>;
|
|
14
|
+
declare const _default: {
|
|
15
|
+
init: typeof init;
|
|
16
|
+
submit: typeof submit;
|
|
17
|
+
submitToByte: typeof submitToByte;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|