@ccos/ccsdk-lite 1.0.10 → 1.0.12
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 +151 -122
- package/lib/index.d.ts +7 -1
- package/lib/system/index.d.ts +4 -2
- package/lib/tts/index.d.ts +17 -0
- package/package.json +1 -1
package/lib/bundle.js
CHANGED
|
@@ -206,9 +206,9 @@ function initSDK() {
|
|
|
206
206
|
return callNative('tiny' + num4.toString(), null);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
var moduleName$
|
|
210
|
-
function getFuncName$
|
|
211
|
-
return moduleName$
|
|
209
|
+
var moduleName$8 = 'network';
|
|
210
|
+
function getFuncName$8(name) {
|
|
211
|
+
return moduleName$8 + '_' + name;
|
|
212
212
|
}
|
|
213
213
|
function paramToUrl(params) {
|
|
214
214
|
if (!params)
|
|
@@ -240,7 +240,7 @@ function paramToUrl(params) {
|
|
|
240
240
|
}
|
|
241
241
|
// 简单的 HTTP 请求
|
|
242
242
|
function simpleHttpRequest(params) {
|
|
243
|
-
return callNative(getFuncName$
|
|
243
|
+
return callNative(getFuncName$8('simpleHttpRequest'), params);
|
|
244
244
|
}
|
|
245
245
|
function httpGet(url, urlParam, header, base64) {
|
|
246
246
|
var paramString = paramToUrl(urlParam);
|
|
@@ -339,19 +339,19 @@ function httpSseGet(url, urlParam, header, base64) {
|
|
|
339
339
|
}
|
|
340
340
|
// 获取网络的基本信息
|
|
341
341
|
function getNetworkInfo() {
|
|
342
|
-
return callNative(getFuncName$
|
|
342
|
+
return callNative(getFuncName$8('getNetworkInfo'), null);
|
|
343
343
|
}
|
|
344
344
|
// 获取合规化后的域名
|
|
345
345
|
function getDomainName(domain) {
|
|
346
|
-
return callNative(getFuncName$
|
|
346
|
+
return callNative(getFuncName$8('getDomainName'), { domain: domain });
|
|
347
347
|
}
|
|
348
348
|
// 获取基本 Header 信息
|
|
349
349
|
function getCommonHeader() {
|
|
350
|
-
return callNative(getFuncName$
|
|
350
|
+
return callNative(getFuncName$8('getCommonHeader'), null);
|
|
351
351
|
}
|
|
352
352
|
// 读取SSE流
|
|
353
353
|
function readSse(params) {
|
|
354
|
-
return callNative(getFuncName$
|
|
354
|
+
return callNative(getFuncName$8('readSse'), params);
|
|
355
355
|
}
|
|
356
356
|
// 下载一个文件到设备本地
|
|
357
357
|
// url : 需要下载的链接
|
|
@@ -368,7 +368,7 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
|
|
|
368
368
|
if (header === void 0) { header = ''; }
|
|
369
369
|
if (postType === void 0) { postType = ''; }
|
|
370
370
|
if (body === void 0) { body = ''; }
|
|
371
|
-
return callNative(getFuncName$
|
|
371
|
+
return callNative(getFuncName$8('downloadToFile'), {
|
|
372
372
|
url: url,
|
|
373
373
|
tempFlag: tempFlag,
|
|
374
374
|
method: method,
|
|
@@ -388,39 +388,39 @@ var network = {
|
|
|
388
388
|
downloadToFile: downloadToFile,
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
var moduleName$
|
|
392
|
-
function getFuncName$
|
|
393
|
-
return moduleName$
|
|
391
|
+
var moduleName$7 = 'app';
|
|
392
|
+
function getFuncName$7(name) {
|
|
393
|
+
return moduleName$7 + '_' + name;
|
|
394
394
|
}
|
|
395
395
|
function getUserInfo() {
|
|
396
|
-
return callNative(getFuncName$
|
|
396
|
+
return callNative(getFuncName$7('getUserInfo'), null);
|
|
397
397
|
}
|
|
398
398
|
function getHostAppInfo() {
|
|
399
|
-
return callNative(getFuncName$
|
|
399
|
+
return callNative(getFuncName$7('getHostAppInfo'), null);
|
|
400
400
|
}
|
|
401
401
|
function startPage(params) {
|
|
402
|
-
return callNative(getFuncName$
|
|
402
|
+
return callNative(getFuncName$7('startPage'), params);
|
|
403
403
|
}
|
|
404
404
|
function startActivity(params) {
|
|
405
|
-
return callNative(getFuncName$
|
|
405
|
+
return callNative(getFuncName$7('startPage'), params);
|
|
406
406
|
}
|
|
407
407
|
function exitPage() {
|
|
408
|
-
callNative(getFuncName$
|
|
408
|
+
callNative(getFuncName$7('exitPage'), null);
|
|
409
409
|
}
|
|
410
410
|
function movePageToBack() {
|
|
411
|
-
return callNative(getFuncName$
|
|
411
|
+
return callNative(getFuncName$7('movePageToBack'), null);
|
|
412
412
|
}
|
|
413
413
|
function startService(params) {
|
|
414
|
-
return callNative(getFuncName$
|
|
414
|
+
return callNative(getFuncName$7('startService'), params);
|
|
415
415
|
}
|
|
416
416
|
function getInstalledAppInfo(params) {
|
|
417
|
-
return callNative(getFuncName$
|
|
417
|
+
return callNative(getFuncName$7('getInstalledAppInfo'), params);
|
|
418
418
|
}
|
|
419
419
|
function getInstalledAppsList() {
|
|
420
|
-
callNative(getFuncName$
|
|
420
|
+
callNative(getFuncName$7('getInstalledAppsList'), null);
|
|
421
421
|
}
|
|
422
422
|
function execActionString(action) {
|
|
423
|
-
return callNative(getFuncName$
|
|
423
|
+
return callNative(getFuncName$7('execActionString'), action);
|
|
424
424
|
}
|
|
425
425
|
var app = {
|
|
426
426
|
getUserInfo: getUserInfo,
|
|
@@ -435,62 +435,66 @@ var app = {
|
|
|
435
435
|
execActionString: execActionString,
|
|
436
436
|
};
|
|
437
437
|
|
|
438
|
-
var moduleName$
|
|
439
|
-
function getFuncName$
|
|
440
|
-
return moduleName$
|
|
438
|
+
var moduleName$6 = 'system';
|
|
439
|
+
function getFuncName$6(name) {
|
|
440
|
+
return moduleName$6 + '_' + name;
|
|
441
441
|
}
|
|
442
442
|
// 告知宿主,小程序或者网页已经准备好
|
|
443
443
|
function ready() {
|
|
444
|
-
return callNative(getFuncName$
|
|
444
|
+
return callNative(getFuncName$6('ready'), null);
|
|
445
445
|
}
|
|
446
446
|
// 获取启动参数
|
|
447
447
|
function getStartupParams() {
|
|
448
|
-
return callNative(getFuncName$
|
|
448
|
+
return callNative(getFuncName$6('getStartupParams'), null);
|
|
449
449
|
}
|
|
450
450
|
// 获取设备信息
|
|
451
451
|
function getDeviceInfo() {
|
|
452
|
-
return callNative(getFuncName$
|
|
452
|
+
return callNative(getFuncName$6('getDeviceInfo'), null);
|
|
453
453
|
}
|
|
454
454
|
// 获取显示屏幕信息
|
|
455
455
|
function getDisplayInfo() {
|
|
456
|
-
return callNative(getFuncName$
|
|
456
|
+
return callNative(getFuncName$6('getDisplayInfo'), null);
|
|
457
457
|
}
|
|
458
458
|
// 获取 android property 的值
|
|
459
459
|
function getProperty(key) {
|
|
460
|
-
return callNative(getFuncName$
|
|
460
|
+
return callNative(getFuncName$6('getProperty'), { propName: key });
|
|
461
461
|
}
|
|
462
462
|
// 检查 JS-API 是否已经实现
|
|
463
463
|
function checkApi(apiName) {
|
|
464
|
-
return callNative(getFuncName$
|
|
464
|
+
return callNative(getFuncName$6('checkApi'), { apiName: apiName });
|
|
465
465
|
}
|
|
466
466
|
// 获取本地字体的路径
|
|
467
467
|
function getFontPath(fontFileName) {
|
|
468
|
-
return callNative(getFuncName$
|
|
468
|
+
return callNative(getFuncName$6('getFontPath'), { fontFileName: fontFileName });
|
|
469
469
|
}
|
|
470
470
|
// 设置屏幕是否常亮
|
|
471
471
|
function setKeepScreenOn(enable) {
|
|
472
|
-
return callNative(getFuncName$
|
|
472
|
+
return callNative(getFuncName$6('setKeepScreenOn'), { enable: enable });
|
|
473
473
|
}
|
|
474
474
|
// 添加事件监听
|
|
475
475
|
function addEventListener(eventName, callback, options) {
|
|
476
476
|
if (options === void 0) { options = {}; }
|
|
477
|
-
return callWithPersistentCallBack(getFuncName$
|
|
477
|
+
return callWithPersistentCallBack(getFuncName$6('addEventListener'), { callbackId: eventName, options: options }, eventName, callback);
|
|
478
478
|
}
|
|
479
479
|
// 删除事件监听
|
|
480
480
|
function removeEventListener(eventName, callback, options) {
|
|
481
481
|
if (options === void 0) { options = {}; }
|
|
482
482
|
var ret = deletePersistentCallBack(eventName, callback);
|
|
483
483
|
if (ret) {
|
|
484
|
-
return callNative(getFuncName$
|
|
484
|
+
return callNative(getFuncName$6('removeEventListener'), { callbackId: eventName, options: options });
|
|
485
485
|
}
|
|
486
486
|
return new Promise(function (resolve) { resolve(); });
|
|
487
487
|
}
|
|
488
488
|
function sendBroadcast(params) {
|
|
489
|
-
return callNative(getFuncName$
|
|
489
|
+
return callNative(getFuncName$6('sendBroadcast'), params);
|
|
490
|
+
}
|
|
491
|
+
// 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
|
|
492
|
+
function registerKeys(params) {
|
|
493
|
+
return callNative(getFuncName$6('registerKeys'), params || { keys: [] });
|
|
490
494
|
}
|
|
491
495
|
// 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
|
|
492
|
-
function
|
|
493
|
-
return callNative(getFuncName$
|
|
496
|
+
function unregisterKeys(params) {
|
|
497
|
+
return callNative(getFuncName$6('unregisterKeys'), params || { keys: [] });
|
|
494
498
|
}
|
|
495
499
|
var system = {
|
|
496
500
|
ready: ready,
|
|
@@ -504,30 +508,31 @@ var system = {
|
|
|
504
508
|
addEventListener: addEventListener,
|
|
505
509
|
removeEventListener: removeEventListener,
|
|
506
510
|
sendBroadcast: sendBroadcast,
|
|
511
|
+
registerKeys: registerKeys,
|
|
512
|
+
unregisterKeys: unregisterKeys,
|
|
507
513
|
//registerKeysOrUnregisterKeys
|
|
508
514
|
//sendEvent
|
|
509
|
-
enableSystemKey: enableSystemKey,
|
|
510
515
|
};
|
|
511
516
|
|
|
512
|
-
var moduleName$
|
|
513
|
-
function getFuncName$
|
|
514
|
-
return moduleName$
|
|
517
|
+
var moduleName$5 = 'storage';
|
|
518
|
+
function getFuncName$5(name) {
|
|
519
|
+
return moduleName$5 + '_' + name;
|
|
515
520
|
}
|
|
516
521
|
function setKey(key, value, namespace) {
|
|
517
522
|
if (namespace === void 0) { namespace = ''; }
|
|
518
|
-
return callNative(getFuncName$
|
|
523
|
+
return callNative(getFuncName$5('setKey'), { key: key, value: value, namespace: namespace });
|
|
519
524
|
}
|
|
520
525
|
function getKey(key, namespace) {
|
|
521
526
|
if (namespace === void 0) { namespace = ''; }
|
|
522
|
-
return callNative(getFuncName$
|
|
527
|
+
return callNative(getFuncName$5('getKey'), { key: key, namespace: namespace });
|
|
523
528
|
}
|
|
524
529
|
function deleteKey(key, namespace) {
|
|
525
530
|
if (namespace === void 0) { namespace = ''; }
|
|
526
|
-
return callNative(getFuncName$
|
|
531
|
+
return callNative(getFuncName$5('deleteKey'), { key: key, namespace: namespace });
|
|
527
532
|
}
|
|
528
533
|
function clearAllKeys(namespace) {
|
|
529
534
|
if (namespace === void 0) { namespace = ''; }
|
|
530
|
-
return callNative(getFuncName$
|
|
535
|
+
return callNative(getFuncName$5('clearAllKeys'), { namespace: namespace });
|
|
531
536
|
}
|
|
532
537
|
var storage = {
|
|
533
538
|
setKey: setKey,
|
|
@@ -536,54 +541,54 @@ var storage = {
|
|
|
536
541
|
clearAllKeys: clearAllKeys
|
|
537
542
|
};
|
|
538
543
|
|
|
539
|
-
var moduleName$
|
|
540
|
-
function getFuncName$
|
|
541
|
-
return moduleName$
|
|
544
|
+
var moduleName$4 = 'audio';
|
|
545
|
+
function getFuncName$4(name) {
|
|
546
|
+
return moduleName$4 + '_' + name;
|
|
542
547
|
}
|
|
543
548
|
// 播放器,播放新的URL或者本地文件系统的路径
|
|
544
549
|
function playNew(path) {
|
|
545
|
-
return callNative(getFuncName$
|
|
550
|
+
return callNative(getFuncName$4('playNew'), { path: path });
|
|
546
551
|
}
|
|
547
552
|
// 播放器,停止播放
|
|
548
553
|
function stop$1() {
|
|
549
|
-
return callNative(getFuncName$
|
|
554
|
+
return callNative(getFuncName$4('stop'), null);
|
|
550
555
|
}
|
|
551
556
|
// 播放器,是否正在播放中
|
|
552
557
|
function isPlaying$1() {
|
|
553
|
-
return callNative(getFuncName$
|
|
558
|
+
return callNative(getFuncName$4('isPlaying'), null);
|
|
554
559
|
}
|
|
555
560
|
// 播放器,是否准备好
|
|
556
561
|
function hasPrepared$1() {
|
|
557
|
-
return callNative(getFuncName$
|
|
562
|
+
return callNative(getFuncName$4('hasPrepared'), null);
|
|
558
563
|
}
|
|
559
564
|
// 播放器,获取总时长
|
|
560
565
|
function getDuration$1() {
|
|
561
|
-
return callNative(getFuncName$
|
|
566
|
+
return callNative(getFuncName$4('getDuration'), null);
|
|
562
567
|
}
|
|
563
568
|
// 播放器,获取当前进度值
|
|
564
569
|
function getCurrentPosition$1() {
|
|
565
|
-
return callNative(getFuncName$
|
|
570
|
+
return callNative(getFuncName$4('getCurrentPosition'), null);
|
|
566
571
|
}
|
|
567
572
|
// 播放器,获取播放状态,返回的value为字符串来标识播放状态
|
|
568
573
|
// 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
|
|
569
574
|
function getPlayerState$1() {
|
|
570
|
-
return callNative(getFuncName$
|
|
575
|
+
return callNative(getFuncName$4('getPlayerState'), null);
|
|
571
576
|
}
|
|
572
577
|
// 播放器,暂停播放
|
|
573
578
|
function pause$1() {
|
|
574
|
-
return callNative(getFuncName$
|
|
579
|
+
return callNative(getFuncName$4('pause'), null);
|
|
575
580
|
}
|
|
576
581
|
// 播放器,启动播放或者从暂停恢复播放
|
|
577
582
|
function start$1() {
|
|
578
|
-
return callNative(getFuncName$
|
|
583
|
+
return callNative(getFuncName$4('start'), null);
|
|
579
584
|
}
|
|
580
585
|
// 播放器,重新播放
|
|
581
586
|
function rePlay$1() {
|
|
582
|
-
return callNative(getFuncName$
|
|
587
|
+
return callNative(getFuncName$4('rePlay'), null);
|
|
583
588
|
}
|
|
584
589
|
// 播放器,seek
|
|
585
590
|
function seekTo$1(position) {
|
|
586
|
-
return callNative(getFuncName$
|
|
591
|
+
return callNative(getFuncName$4('seekTo'), { position: Math.floor(position) });
|
|
587
592
|
}
|
|
588
593
|
// 播放器,设置单片循环模式
|
|
589
594
|
// isLooping: 是否循环播放
|
|
@@ -591,16 +596,16 @@ function seekTo$1(position) {
|
|
|
591
596
|
// 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
|
|
592
597
|
function setLooping$1(isLooping, silentLoop) {
|
|
593
598
|
if (silentLoop === void 0) { silentLoop = false; }
|
|
594
|
-
return callNative(getFuncName$
|
|
599
|
+
return callNative(getFuncName$4('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
|
|
595
600
|
}
|
|
596
601
|
// 设置音量
|
|
597
602
|
function setVolume(volume) {
|
|
598
|
-
return callNative(getFuncName$
|
|
603
|
+
return callNative(getFuncName$4('setVolume'), { volume: volume });
|
|
599
604
|
}
|
|
600
605
|
// 设置播放内核
|
|
601
606
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
602
607
|
function setPlayerCore$1(core) {
|
|
603
|
-
return callNative(getFuncName$
|
|
608
|
+
return callNative(getFuncName$4('setPlayerCore'), { core: core });
|
|
604
609
|
}
|
|
605
610
|
var audio = {
|
|
606
611
|
playNew: playNew,
|
|
@@ -619,62 +624,62 @@ var audio = {
|
|
|
619
624
|
setPlayerCore: setPlayerCore$1,
|
|
620
625
|
};
|
|
621
626
|
|
|
622
|
-
var moduleName$
|
|
623
|
-
function getFuncName$
|
|
624
|
-
return moduleName$
|
|
627
|
+
var moduleName$3 = 'video';
|
|
628
|
+
function getFuncName$3(name) {
|
|
629
|
+
return moduleName$3 + '_' + name;
|
|
625
630
|
}
|
|
626
631
|
// 设置视频播放窗口的位置与宽高
|
|
627
632
|
function setVideoLayout(width, height, x, y) {
|
|
628
|
-
return callNative(getFuncName$
|
|
633
|
+
return callNative(getFuncName$3('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
|
|
629
634
|
}
|
|
630
635
|
// 设置视频窗口是否显示
|
|
631
636
|
function setVideoVisible(show) {
|
|
632
|
-
return callNative(getFuncName$
|
|
637
|
+
return callNative(getFuncName$3('setVideoVisible'), { visible: show });
|
|
633
638
|
}
|
|
634
639
|
// 播放器,播放新的URL
|
|
635
640
|
function playNewUrl(url) {
|
|
636
|
-
return callNative(getFuncName$
|
|
641
|
+
return callNative(getFuncName$3('playNewUrl'), { url: url });
|
|
637
642
|
}
|
|
638
643
|
// 播放器,播放新的本地文件路径
|
|
639
644
|
function playNewFile(path) {
|
|
640
|
-
return callNative(getFuncName$
|
|
645
|
+
return callNative(getFuncName$3('playNewFile'), { path: path });
|
|
641
646
|
}
|
|
642
647
|
// 播放器,停止播放
|
|
643
648
|
function stop() {
|
|
644
|
-
return callNative(getFuncName$
|
|
649
|
+
return callNative(getFuncName$3('stop'), null);
|
|
645
650
|
}
|
|
646
651
|
// 播放器,暂停播放
|
|
647
652
|
function pause() {
|
|
648
|
-
return callNative(getFuncName$
|
|
653
|
+
return callNative(getFuncName$3('pause'), null);
|
|
649
654
|
}
|
|
650
655
|
// 播放器,启动播放或者从暂停恢复播放
|
|
651
656
|
function start() {
|
|
652
|
-
return callNative(getFuncName$
|
|
657
|
+
return callNative(getFuncName$3('start'), null);
|
|
653
658
|
}
|
|
654
659
|
// 播放器,seek
|
|
655
660
|
function seekTo(position) {
|
|
656
|
-
return callNative(getFuncName$
|
|
661
|
+
return callNative(getFuncName$3('seekTo'), { position: Math.floor(position) });
|
|
657
662
|
}
|
|
658
663
|
// 播放器,是否准备好
|
|
659
664
|
function hasPrepared() {
|
|
660
|
-
return callNative(getFuncName$
|
|
665
|
+
return callNative(getFuncName$3('hasPrepared'), null);
|
|
661
666
|
}
|
|
662
667
|
// 播放器,是否正在播放中
|
|
663
668
|
function isPlaying() {
|
|
664
|
-
return callNative(getFuncName$
|
|
669
|
+
return callNative(getFuncName$3('isPlaying'), null);
|
|
665
670
|
}
|
|
666
671
|
// 播放器,获取总时长
|
|
667
672
|
function getDuration() {
|
|
668
|
-
return callNative(getFuncName$
|
|
673
|
+
return callNative(getFuncName$3('getDuration'), null);
|
|
669
674
|
}
|
|
670
675
|
// 播放器,获取当前进度值
|
|
671
676
|
function getCurrentPosition() {
|
|
672
|
-
return callNative(getFuncName$
|
|
677
|
+
return callNative(getFuncName$3('getCurrentPosition'), null);
|
|
673
678
|
}
|
|
674
679
|
// 播放器,获取播放状态,返回的value为字符串来标识播放状态
|
|
675
680
|
// 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
|
|
676
681
|
function getPlayerState() {
|
|
677
|
-
return callNative(getFuncName$
|
|
682
|
+
return callNative(getFuncName$3('getPlayerState'), null);
|
|
678
683
|
}
|
|
679
684
|
// 播放器,设置单片循环模式
|
|
680
685
|
// isLooping: 是否循环播放
|
|
@@ -682,40 +687,40 @@ function getPlayerState() {
|
|
|
682
687
|
// 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
|
|
683
688
|
function setLooping(isLooping, silentLoop) {
|
|
684
689
|
if (silentLoop === void 0) { silentLoop = false; }
|
|
685
|
-
return callNative(getFuncName$
|
|
690
|
+
return callNative(getFuncName$3('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
|
|
686
691
|
}
|
|
687
692
|
// 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
|
|
688
693
|
function setAutoWakeLock(autoWakeLock) {
|
|
689
|
-
return callNative(getFuncName$
|
|
694
|
+
return callNative(getFuncName$3('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
|
|
690
695
|
}
|
|
691
696
|
// 播放器,重新播放
|
|
692
697
|
function rePlay() {
|
|
693
|
-
return callNative(getFuncName$
|
|
698
|
+
return callNative(getFuncName$3('rePlay'), null);
|
|
694
699
|
}
|
|
695
700
|
// 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
|
|
696
701
|
function setPlayWhenReady(playWhenReady) {
|
|
697
702
|
if (playWhenReady === void 0) { playWhenReady = true; }
|
|
698
|
-
return callNative(getFuncName$
|
|
703
|
+
return callNative(getFuncName$3('setPlayWhenReady'), { playWhenReady: playWhenReady });
|
|
699
704
|
}
|
|
700
705
|
// 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
|
|
701
706
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
702
707
|
function getPlayerCore() {
|
|
703
|
-
return callNative(getFuncName$
|
|
708
|
+
return callNative(getFuncName$3('getPlayerCore'), null);
|
|
704
709
|
}
|
|
705
710
|
// 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
|
|
706
711
|
// 值: MediaPlayer, SocPlayer, ExoPlayer
|
|
707
712
|
function getRealPlayerCore() {
|
|
708
|
-
return callNative(getFuncName$
|
|
713
|
+
return callNative(getFuncName$3('getRealPlayerCore'), null);
|
|
709
714
|
}
|
|
710
715
|
// 设置播放内核
|
|
711
716
|
// 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
|
|
712
717
|
function setPlayerCore(core) {
|
|
713
|
-
return callNative(getFuncName$
|
|
718
|
+
return callNative(getFuncName$3('setPlayerCore'), { core: core });
|
|
714
719
|
}
|
|
715
720
|
// 设置渲染模式
|
|
716
721
|
// 值: SurfaceView, TextureView
|
|
717
722
|
function setRenderType(playerRender) {
|
|
718
|
-
return callNative(getFuncName$
|
|
723
|
+
return callNative(getFuncName$3('setRenderType'), { playerRender: playerRender });
|
|
719
724
|
}
|
|
720
725
|
var video = {
|
|
721
726
|
setVideoLayout: setVideoLayout,
|
|
@@ -741,9 +746,9 @@ var video = {
|
|
|
741
746
|
setRenderType: setRenderType,
|
|
742
747
|
};
|
|
743
748
|
|
|
744
|
-
var moduleName$
|
|
745
|
-
function getFuncName$
|
|
746
|
-
return moduleName$
|
|
749
|
+
var moduleName$2 = 'fs';
|
|
750
|
+
function getFuncName$2(name) {
|
|
751
|
+
return moduleName$2 + '_' + name;
|
|
747
752
|
}
|
|
748
753
|
// 读取文件并返回文件的所有内容
|
|
749
754
|
// 参数:
|
|
@@ -751,7 +756,7 @@ function getFuncName$1(name) {
|
|
|
751
756
|
// base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
|
|
752
757
|
function readAllContent(path, base64Flag) {
|
|
753
758
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
754
|
-
return callNative(getFuncName$
|
|
759
|
+
return callNative(getFuncName$2('readAllContent'), { path: path, base64Flag: base64Flag });
|
|
755
760
|
}
|
|
756
761
|
// 将内容全部写入文件
|
|
757
762
|
// 参数:
|
|
@@ -760,114 +765,114 @@ function readAllContent(path, base64Flag) {
|
|
|
760
765
|
// base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
|
|
761
766
|
function writeAllContent(path, content, base64Flag) {
|
|
762
767
|
if (base64Flag === void 0) { base64Flag = false; }
|
|
763
|
-
return callNative(getFuncName$
|
|
768
|
+
return callNative(getFuncName$2('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
|
|
764
769
|
}
|
|
765
770
|
// 获取应用基本目录的全路径名
|
|
766
771
|
function getAppBaseDir() {
|
|
767
|
-
return callNative(getFuncName$
|
|
772
|
+
return callNative(getFuncName$2('getAppBaseDir'), null);
|
|
768
773
|
}
|
|
769
774
|
// 获取 Cache 目录的全路径名
|
|
770
775
|
function getAppCacheDir() {
|
|
771
|
-
return callNative(getFuncName$
|
|
776
|
+
return callNative(getFuncName$2('getAppCacheDir'), null);
|
|
772
777
|
}
|
|
773
778
|
// 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
|
|
774
779
|
// 参数:
|
|
775
780
|
// fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
|
|
776
781
|
function makeCacheFile(fileName) {
|
|
777
782
|
if (fileName === void 0) { fileName = ''; }
|
|
778
|
-
return callNative(getFuncName$
|
|
783
|
+
return callNative(getFuncName$2('makeCacheFile'), { fileName: fileName });
|
|
779
784
|
}
|
|
780
785
|
// 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
|
|
781
786
|
// 参数:
|
|
782
787
|
// fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
|
|
783
788
|
function makeNormalFile(fileName) {
|
|
784
789
|
if (fileName === void 0) { fileName = ''; }
|
|
785
|
-
return callNative(getFuncName$
|
|
790
|
+
return callNative(getFuncName$2('makeNormalFile'), { fileName: fileName });
|
|
786
791
|
}
|
|
787
792
|
// 检测一个文件或者目录是否存在
|
|
788
793
|
// 参数:
|
|
789
794
|
// path: 指定路径
|
|
790
795
|
function exists(path) {
|
|
791
|
-
return callNative(getFuncName$
|
|
796
|
+
return callNative(getFuncName$2('exists'), { path: path });
|
|
792
797
|
}
|
|
793
798
|
// 检测一个路径是否为一个普通文件
|
|
794
799
|
// 参数:
|
|
795
800
|
// path: 指定路径
|
|
796
801
|
function isFile(path) {
|
|
797
|
-
return callNative(getFuncName$
|
|
802
|
+
return callNative(getFuncName$2('isFile'), { path: path });
|
|
798
803
|
}
|
|
799
804
|
// 检测一个路径是否为一个目录
|
|
800
805
|
// 参数:
|
|
801
806
|
// path: 指定路径
|
|
802
807
|
function isDirectory(path) {
|
|
803
|
-
return callNative(getFuncName$
|
|
808
|
+
return callNative(getFuncName$2('isDirectory'), { path: path });
|
|
804
809
|
}
|
|
805
810
|
// 检测一个路径表示的文件或目录 是否是隐藏的
|
|
806
811
|
// 参数:
|
|
807
812
|
// path: 指定路径
|
|
808
813
|
function isHidden(path) {
|
|
809
|
-
return callNative(getFuncName$
|
|
814
|
+
return callNative(getFuncName$2('isHidden'), { path: path });
|
|
810
815
|
}
|
|
811
816
|
// 检测一个路径表示的文件或目录 是否可读
|
|
812
817
|
// 参数:
|
|
813
818
|
// path: 指定路径
|
|
814
819
|
function canRead(path) {
|
|
815
|
-
return callNative(getFuncName$
|
|
820
|
+
return callNative(getFuncName$2('canRead'), { path: path });
|
|
816
821
|
}
|
|
817
822
|
// 检测一个路径表示的文件或目录 是否可写
|
|
818
823
|
// 参数:
|
|
819
824
|
// path: 指定路径
|
|
820
825
|
function canWrite(path) {
|
|
821
|
-
return callNative(getFuncName$
|
|
826
|
+
return callNative(getFuncName$2('canWrite'), { path: path });
|
|
822
827
|
}
|
|
823
828
|
// 检测一个路径表示的文件或目录 是否可执行
|
|
824
829
|
// 参数:
|
|
825
830
|
// path: 指定路径
|
|
826
831
|
function canExecute(path) {
|
|
827
|
-
return callNative(getFuncName$
|
|
832
|
+
return callNative(getFuncName$2('canExecute'), { path: path });
|
|
828
833
|
}
|
|
829
834
|
// 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
|
|
830
835
|
// 参数:
|
|
831
836
|
// path: 指定路径
|
|
832
837
|
function lastModified(path) {
|
|
833
|
-
return callNative(getFuncName$
|
|
838
|
+
return callNative(getFuncName$2('lastModified'), { path: path });
|
|
834
839
|
}
|
|
835
840
|
// 删除文件
|
|
836
841
|
// 参数:
|
|
837
842
|
// path: 指定路径
|
|
838
843
|
function deleteIt(path) {
|
|
839
|
-
return callNative(getFuncName$
|
|
844
|
+
return callNative(getFuncName$2('delete'), { path: path });
|
|
840
845
|
}
|
|
841
846
|
// 新建目录
|
|
842
847
|
// 参数:
|
|
843
848
|
// path: 指定路径
|
|
844
849
|
function mkdir(path) {
|
|
845
|
-
return callNative(getFuncName$
|
|
850
|
+
return callNative(getFuncName$2('mkdir'), { path: path });
|
|
846
851
|
}
|
|
847
852
|
// 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
|
|
848
853
|
// 参数:
|
|
849
854
|
// path: 指定路径
|
|
850
855
|
function mkdirs(path) {
|
|
851
|
-
return callNative(getFuncName$
|
|
856
|
+
return callNative(getFuncName$2('mkdirs'), { path: path });
|
|
852
857
|
}
|
|
853
858
|
// 改名
|
|
854
859
|
// 参数:
|
|
855
860
|
// from: 指定源路径
|
|
856
861
|
// to: 指定目标路径
|
|
857
862
|
function rename(from, to) {
|
|
858
|
-
return callNative(getFuncName$
|
|
863
|
+
return callNative(getFuncName$2('rename'), { from: from, to: to });
|
|
859
864
|
}
|
|
860
865
|
// 将相对路径的转换为全路径
|
|
861
866
|
// 参数:
|
|
862
867
|
// path: 指定路径
|
|
863
868
|
function getAbsolutePath(path) {
|
|
864
|
-
return callNative(getFuncName$
|
|
869
|
+
return callNative(getFuncName$2('getAbsolutePath'), { path: path });
|
|
865
870
|
}
|
|
866
871
|
// 指定路径创建新文件
|
|
867
872
|
// 参数:
|
|
868
873
|
// path: 指定路径
|
|
869
874
|
function createNewFile(path) {
|
|
870
|
-
return callNative(getFuncName$
|
|
875
|
+
return callNative(getFuncName$2('createNewFile'), { path: path });
|
|
871
876
|
}
|
|
872
877
|
// 设置可读属性
|
|
873
878
|
// 参数:
|
|
@@ -875,7 +880,7 @@ function createNewFile(path) {
|
|
|
875
880
|
// value: 是否可读
|
|
876
881
|
function setReadable(path, value) {
|
|
877
882
|
if (value === void 0) { value = true; }
|
|
878
|
-
return callNative(getFuncName$
|
|
883
|
+
return callNative(getFuncName$2('setReadable'), { path: path, value: value });
|
|
879
884
|
}
|
|
880
885
|
// 设置可写属性
|
|
881
886
|
// 参数:
|
|
@@ -883,7 +888,7 @@ function setReadable(path, value) {
|
|
|
883
888
|
// value: 是否可写
|
|
884
889
|
function setWritable(path, value) {
|
|
885
890
|
if (value === void 0) { value = true; }
|
|
886
|
-
return callNative(getFuncName$
|
|
891
|
+
return callNative(getFuncName$2('setWritable'), { path: path, value: value });
|
|
887
892
|
}
|
|
888
893
|
// 设置可执行属性
|
|
889
894
|
// 参数:
|
|
@@ -891,7 +896,7 @@ function setWritable(path, value) {
|
|
|
891
896
|
// value: 是否可执行
|
|
892
897
|
function setExecutable(path, value) {
|
|
893
898
|
if (value === void 0) { value = true; }
|
|
894
|
-
return callNative(getFuncName$
|
|
899
|
+
return callNative(getFuncName$2('setExecutable'), { path: path, value: value });
|
|
895
900
|
}
|
|
896
901
|
// 设置文件最后修改的时间
|
|
897
902
|
// 参数:
|
|
@@ -899,13 +904,13 @@ function setExecutable(path, value) {
|
|
|
899
904
|
// value: 时间戳
|
|
900
905
|
function setLastModified(path, value) {
|
|
901
906
|
if (value === void 0) { value = 0; }
|
|
902
|
-
return callNative(getFuncName$
|
|
907
|
+
return callNative(getFuncName$2('setLastModified'), { path: path, value: value });
|
|
903
908
|
}
|
|
904
909
|
// 读取目录,返回该目录下的文件列表
|
|
905
910
|
// 参数:
|
|
906
911
|
// path: 指定路径
|
|
907
912
|
function list(path) {
|
|
908
|
-
return callNative(getFuncName$
|
|
913
|
+
return callNative(getFuncName$2('list'), { path: path });
|
|
909
914
|
}
|
|
910
915
|
var fs = {
|
|
911
916
|
readAllContent: readAllContent,
|
|
@@ -935,19 +940,19 @@ var fs = {
|
|
|
935
940
|
list: list
|
|
936
941
|
};
|
|
937
942
|
|
|
938
|
-
var moduleName = 'pag';
|
|
939
|
-
function getFuncName(name) {
|
|
940
|
-
return moduleName + '_' + name;
|
|
943
|
+
var moduleName$1 = 'pag';
|
|
944
|
+
function getFuncName$1(name) {
|
|
945
|
+
return moduleName$1 + '_' + name;
|
|
941
946
|
}
|
|
942
947
|
// 播放PAG动画
|
|
943
948
|
// repeat: 循环次数 -1 表示无限
|
|
944
949
|
//
|
|
945
950
|
function startNewPagAni(params) {
|
|
946
|
-
return callNative(getFuncName('startNewPagAni'), params);
|
|
951
|
+
return callNative(getFuncName$1('startNewPagAni'), params);
|
|
947
952
|
}
|
|
948
953
|
// 停止PAG动画,并消失
|
|
949
954
|
function stopPagAni() {
|
|
950
|
-
return callNative(getFuncName('stopPagAni'), null);
|
|
955
|
+
return callNative(getFuncName$1('stopPagAni'), null);
|
|
951
956
|
}
|
|
952
957
|
function setPagVisibility(visible) {
|
|
953
958
|
if (visible === void 0) { visible = true; }
|
|
@@ -964,10 +969,10 @@ function setPagVisibility(visible) {
|
|
|
964
969
|
else {
|
|
965
970
|
value = visible;
|
|
966
971
|
}
|
|
967
|
-
return callNative(getFuncName('setPagVisibility'), { visible: value });
|
|
972
|
+
return callNative(getFuncName$1('setPagVisibility'), { visible: value });
|
|
968
973
|
}
|
|
969
974
|
function setPagXY(x, y) {
|
|
970
|
-
return callNative(getFuncName('setPagXY'), { x: x, y: y });
|
|
975
|
+
return callNative(getFuncName$1('setPagXY'), { x: x, y: y });
|
|
971
976
|
}
|
|
972
977
|
// // 播报 TTS 文本语音
|
|
973
978
|
// export function sendTts(text: string, ttsId: string): Promise<any> {
|
|
@@ -1010,6 +1015,29 @@ var pag = {
|
|
|
1010
1015
|
// clearBackground,
|
|
1011
1016
|
};
|
|
1012
1017
|
|
|
1018
|
+
var moduleName = 'tts';
|
|
1019
|
+
function getFuncName(name) {
|
|
1020
|
+
return moduleName + '_' + name;
|
|
1021
|
+
}
|
|
1022
|
+
// 停止TTS播报
|
|
1023
|
+
//
|
|
1024
|
+
function stopTts() {
|
|
1025
|
+
return callNative(getFuncName('stopTts'), {});
|
|
1026
|
+
}
|
|
1027
|
+
// 开始 TTS 播报
|
|
1028
|
+
function sendTts(text, ttsId) {
|
|
1029
|
+
return callNative(getFuncName('sendTts'), { text: text, ttsId: ttsId });
|
|
1030
|
+
}
|
|
1031
|
+
// 流式播报 TTS
|
|
1032
|
+
function sendStreamTts(text, ttsId, isFirst, isEnd) {
|
|
1033
|
+
return callNative(getFuncName('sendStreamTts'), { text: text, ttsId: ttsId, isFirst: isFirst, isEnd: isEnd });
|
|
1034
|
+
}
|
|
1035
|
+
var tts = {
|
|
1036
|
+
stopTts: stopTts,
|
|
1037
|
+
sendTts: sendTts,
|
|
1038
|
+
sendStreamTts: sendStreamTts,
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1013
1041
|
function apkNativeCallJs(str) {
|
|
1014
1042
|
var res = null;
|
|
1015
1043
|
//console.log('str1=' + str);
|
|
@@ -1057,6 +1085,7 @@ var index = {
|
|
|
1057
1085
|
audio: audio,
|
|
1058
1086
|
video: video,
|
|
1059
1087
|
pag: pag,
|
|
1088
|
+
tts: tts,
|
|
1060
1089
|
fs: fs,
|
|
1061
1090
|
isRunInAppBrowser: isRunInAppBrowser
|
|
1062
1091
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ declare const _default: {
|
|
|
37
37
|
addEventListener: typeof import("./system").addEventListener;
|
|
38
38
|
removeEventListener: typeof import("./system").removeEventListener;
|
|
39
39
|
sendBroadcast: typeof import("./system").sendBroadcast;
|
|
40
|
-
|
|
40
|
+
registerKeys: typeof import("./system").registerKeys;
|
|
41
|
+
unregisterKeys: typeof import("./system").unregisterKeys;
|
|
41
42
|
};
|
|
42
43
|
storage: {
|
|
43
44
|
setKey: typeof import("./storage").setKey;
|
|
@@ -90,6 +91,11 @@ declare const _default: {
|
|
|
90
91
|
setPagVisibility: typeof import("./pag").setPagVisibility;
|
|
91
92
|
setPagXY: typeof import("./pag").setPagXY;
|
|
92
93
|
};
|
|
94
|
+
tts: {
|
|
95
|
+
stopTts: typeof import("./tts").stopTts;
|
|
96
|
+
sendTts: typeof import("./tts").sendTts;
|
|
97
|
+
sendStreamTts: typeof import("./tts").sendStreamTts;
|
|
98
|
+
};
|
|
93
99
|
fs: {
|
|
94
100
|
readAllContent: typeof import("./file").readAllContent;
|
|
95
101
|
writeAllContent: typeof import("./file").writeAllContent;
|
package/lib/system/index.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export declare function setKeepScreenOn(enable: boolean): Promise<any>;
|
|
|
19
19
|
export declare function addEventListener(eventName: string, callback: Function, options?: object): Promise<any>;
|
|
20
20
|
export declare function removeEventListener(eventName: string, callback: Function, options?: object): Promise<any>;
|
|
21
21
|
export declare function sendBroadcast(params: IntentParam): Promise<any>;
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function registerKeys(params: SystemKeyParam | null): Promise<any>;
|
|
23
|
+
export declare function unregisterKeys(params: SystemKeyParam | null): Promise<any>;
|
|
23
24
|
declare const _default: {
|
|
24
25
|
ready: typeof ready;
|
|
25
26
|
getStartupParams: typeof getStartupParams;
|
|
@@ -32,6 +33,7 @@ declare const _default: {
|
|
|
32
33
|
addEventListener: typeof addEventListener;
|
|
33
34
|
removeEventListener: typeof removeEventListener;
|
|
34
35
|
sendBroadcast: typeof sendBroadcast;
|
|
35
|
-
|
|
36
|
+
registerKeys: typeof registerKeys;
|
|
37
|
+
unregisterKeys: typeof unregisterKeys;
|
|
36
38
|
};
|
|
37
39
|
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface StartPAGParam {
|
|
2
|
+
path: string;
|
|
3
|
+
repeat: number;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function stopTts(): Promise<any>;
|
|
10
|
+
export declare function sendTts(text: string, ttsId: string): Promise<any>;
|
|
11
|
+
export declare function sendStreamTts(text: string, ttsId: string, isFirst: boolean, isEnd: boolean): Promise<any>;
|
|
12
|
+
declare const _default: {
|
|
13
|
+
stopTts: typeof stopTts;
|
|
14
|
+
sendTts: typeof sendTts;
|
|
15
|
+
sendStreamTts: typeof sendStreamTts;
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|