@ccos/ccsdk-lite 1.0.10 → 1.0.11

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