@ccos/ccsdk-lite 1.0.5 → 1.0.7

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
@@ -58,6 +58,7 @@ var Bus = /** @class */ (function () {
58
58
  var bus = new Bus();
59
59
 
60
60
  var actionList = []; // 这里保存, 未注册命令处理函数之前,APP发过来的命令
61
+ var apiCode = '';
61
62
  function defaultAppCmd(cmd, payload) {
62
63
  console.log('default appCmd ' + cmd);
63
64
  actionList.push({ cmd: cmd, payload: payload }); // 有可能APP发过来的命令比较早,而页面的一些初始化还没有做完,这时把命令先存起来,放到 actionList 中
@@ -91,7 +92,8 @@ function nativeCall(funcName, callbackId, params) {
91
92
  var object1 = {
92
93
  func: funcName,
93
94
  id: callbackId,
94
- params: params || {}
95
+ params: params || {},
96
+ apiCode: apiCode,
95
97
  };
96
98
  window['_liteNativeApi'].exec(JSON.stringify(object1));
97
99
  }
@@ -156,10 +158,24 @@ function callbackFromNative(callbackId, data) {
156
158
  bus.remove(callbackId);
157
159
  }
158
160
  }
161
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
162
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
163
+ function initSDK() {
164
+ var num1 = Math.floor(Math.random() * 65536);
165
+ var num2 = Math.floor(Math.random() * 16384);
166
+ var num3 = num2 * 65536 + num1;
167
+ if (num3 < 112) {
168
+ num3 = 112;
169
+ }
170
+ var num4 = num3 - 111;
171
+ apiCode = num3.toString();
172
+ //console.log('apiCode = ' + apiCode);
173
+ return callNative('tiny' + num4.toString(), null);
174
+ }
159
175
 
160
- var moduleName$6 = 'network';
161
- function getFuncName$6(name) {
162
- return moduleName$6 + '_' + name;
176
+ var moduleName$7 = 'network';
177
+ function getFuncName$7(name) {
178
+ return moduleName$7 + '_' + name;
163
179
  }
164
180
  function paramToUrl(params) {
165
181
  if (!params)
@@ -191,7 +207,7 @@ function paramToUrl(params) {
191
207
  }
192
208
  // 简单的 HTTP 请求
193
209
  function simpleHttpRequest(params) {
194
- return callNative(getFuncName$6('simpleHttpRequest'), params);
210
+ return callNative(getFuncName$7('simpleHttpRequest'), params);
195
211
  }
196
212
  function httpGet(url, urlParam, header, base64) {
197
213
  var paramString = paramToUrl(urlParam);
@@ -290,19 +306,19 @@ function httpSseGet(url, urlParam, header, base64) {
290
306
  }
291
307
  // 获取网络的基本信息
292
308
  function getNetworkInfo() {
293
- return callNative(getFuncName$6('getNetworkInfo'), null);
309
+ return callNative(getFuncName$7('getNetworkInfo'), null);
294
310
  }
295
311
  // 获取合规化后的域名
296
312
  function getDomainName(domain) {
297
- return callNative(getFuncName$6('getDomainName'), { domain: domain });
313
+ return callNative(getFuncName$7('getDomainName'), { domain: domain });
298
314
  }
299
315
  // 获取基本 Header 信息
300
316
  function getCommonHeader() {
301
- return callNative(getFuncName$6('getCommonHeader'), null);
317
+ return callNative(getFuncName$7('getCommonHeader'), null);
302
318
  }
303
319
  // 读取SSE流
304
320
  function readSse(params) {
305
- return callNative(getFuncName$6('readSse'), params);
321
+ return callNative(getFuncName$7('readSse'), params);
306
322
  }
307
323
  // 下载一个文件到设备本地
308
324
  // url : 需要下载的链接
@@ -319,7 +335,7 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
319
335
  if (header === void 0) { header = ''; }
320
336
  if (postType === void 0) { postType = ''; }
321
337
  if (body === void 0) { body = ''; }
322
- return callNative(getFuncName$6('downloadToFile'), {
338
+ return callNative(getFuncName$7('downloadToFile'), {
323
339
  url: url,
324
340
  tempFlag: tempFlag,
325
341
  method: method,
@@ -328,6 +344,28 @@ function downloadToFile(url, tempFlag, method, header, postType, body) {
328
344
  body: body
329
345
  });
330
346
  }
347
+ var downloadListenerCallbackId = 'downloadListenerCallbackId';
348
+ // 设置下载的事件回调
349
+ // 注意: 使用此回调的话,不用时记得使用 deleteDownloadListener 注销事件回调
350
+ function setDownloadListener(callback) {
351
+ return callWithPersistentCallBack(getFuncName$7('setDownloadListener'), { callbackId: downloadListenerCallbackId }, downloadListenerCallbackId, callback);
352
+ }
353
+ // 注销下载的事件回调
354
+ function deleteDownloadListener() {
355
+ deletePersistentCallBack(downloadListenerCallbackId);
356
+ return callNative(getFuncName$7('deleteDownloadListener'), null);
357
+ }
358
+ var streamResponseListenerCallbackId = 'streamResponseListenerCallbackId';
359
+ // 设置SSE请求的事件回调
360
+ // 注意: 使用此回调的话,不用时记得使用 deleteStreamResponseListener 注销事件回调
361
+ function setStreamResponseListener(callback) {
362
+ return callWithPersistentCallBack(getFuncName$7('setStreamResponseListener'), { callbackId: streamResponseListenerCallbackId }, streamResponseListenerCallbackId, callback);
363
+ }
364
+ // 注销SSE请求的事件回调
365
+ function deleteStreamResponseListener() {
366
+ deletePersistentCallBack(streamResponseListenerCallbackId);
367
+ return callNative(getFuncName$7('deleteStreamResponseListener'), null);
368
+ }
331
369
  var network = {
332
370
  simpleHttpRequest: simpleHttpRequest,
333
371
  httpGet: httpGet,
@@ -336,46 +374,50 @@ var network = {
336
374
  getNetworkInfo: getNetworkInfo,
337
375
  getDomainName: getDomainName,
338
376
  getCommonHeader: getCommonHeader,
339
- downloadToFile: downloadToFile
377
+ downloadToFile: downloadToFile,
378
+ setDownloadListener: setDownloadListener,
379
+ deleteDownloadListener: deleteDownloadListener,
380
+ setStreamResponseListener: setStreamResponseListener,
381
+ deleteStreamResponseListener: deleteStreamResponseListener,
340
382
  };
341
383
 
342
- var moduleName$5 = 'app';
384
+ var moduleName$6 = 'app';
343
385
  var localBroadcastHookCallbackId = 'localBroadcastHookCallbackId';
344
386
  var globalBroadcastHookCallbackId = 'globalBroadcastHookCallbackId';
345
387
  var localBroadcastActionMap = new Map();
346
388
  var globalBroadcastActionMap = new Map();
347
- function getFuncName$5(name) {
348
- return moduleName$5 + '_' + name;
389
+ function getFuncName$6(name) {
390
+ return moduleName$6 + '_' + name;
349
391
  }
350
392
  function startActivity(params) {
351
- return callNative(getFuncName$5('startActivity'), params);
393
+ return callNative(getFuncName$6('startActivity'), params);
352
394
  }
353
395
  function startService(params) {
354
- return callNative(getFuncName$5('startService'), params);
396
+ return callNative(getFuncName$6('startService'), params);
355
397
  }
356
398
  function sendBroadcast(params) {
357
- return callNative(getFuncName$5('sendBroadcast'), params);
399
+ return callNative(getFuncName$6('sendBroadcast'), params);
358
400
  }
359
401
  function sendLocalBroadcast(params) {
360
- return callNative(getFuncName$5('sendLocalBroadcast'), params);
402
+ return callNative(getFuncName$6('sendLocalBroadcast'), params);
361
403
  }
362
404
  function startBackEndAction(action) {
363
- return callNative(getFuncName$5('startBackEndAction'), action);
405
+ return callNative(getFuncName$6('startBackEndAction'), action);
364
406
  }
365
407
  function exitPage() {
366
- callNative(getFuncName$5('exitPage'), null);
408
+ callNative(getFuncName$6('exitPage'), null);
367
409
  }
368
410
  function moveTaskToBack() {
369
- return callNative(getFuncName$5('moveTaskToBack'), null);
411
+ return callNative(getFuncName$6('moveTaskToBack'), null);
370
412
  }
371
413
  function getUserInfo() {
372
- return callNative(getFuncName$5('getUserInfo'), null);
414
+ return callNative(getFuncName$6('getUserInfo'), null);
373
415
  }
374
416
  function getAppList() {
375
- return callNative(getFuncName$5('getAppList'), null);
417
+ return callNative(getFuncName$6('getAppList'), null);
376
418
  }
377
419
  function getAppInfo(params) {
378
- return callNative(getFuncName$5('getAppInfo'), params);
420
+ return callNative(getFuncName$6('getAppInfo'), params);
379
421
  }
380
422
  function processLocalBroadcast(payload) {
381
423
  if (payload.hasOwnProperty('action')) {
@@ -399,31 +441,23 @@ function processGlobalBroadcast(payload) {
399
441
  }
400
442
  }
401
443
  }
402
- function addLocalBroadcastHook(action, callback) {
444
+ function setLocalBroadcastHook(action, callback) {
403
445
  localBroadcastActionMap.set(action, callback); // action 如存在会更新
404
446
  //
405
- return callWithPersistentCallBack(getFuncName$5('addLocalBroadcastHook'), { callbackId: localBroadcastHookCallbackId, action: action }, localBroadcastHookCallbackId, processLocalBroadcast);
447
+ return callWithPersistentCallBack(getFuncName$6('setLocalBroadcastHook'), { callbackId: localBroadcastHookCallbackId, action: action }, localBroadcastHookCallbackId, processLocalBroadcast);
406
448
  }
407
449
  function deleteLocalBroadcastHook(action) {
408
450
  localBroadcastActionMap.delete(action);
409
- return callNative(getFuncName$5('deleteLocalBroadcastHook'), { action: action });
451
+ return callNative(getFuncName$6('deleteLocalBroadcastHook'), { action: action });
410
452
  }
411
- function addBroadcastHook(action, callback) {
453
+ function setBroadcastHook(action, callback) {
412
454
  globalBroadcastActionMap.set(action, callback); // action 如存在会更新
413
455
  //
414
- return callWithPersistentCallBack(getFuncName$5('addBroadcastHook'), { callbackId: globalBroadcastHookCallbackId, action: action }, globalBroadcastHookCallbackId, processGlobalBroadcast);
456
+ return callWithPersistentCallBack(getFuncName$6('setBroadcastHook'), { callbackId: globalBroadcastHookCallbackId, action: action }, globalBroadcastHookCallbackId, processGlobalBroadcast);
415
457
  }
416
458
  function deleteBroadcastHook(action) {
417
459
  globalBroadcastActionMap.delete(action);
418
- return callNative(getFuncName$5('deleteBroadcastHook'), { action: action });
419
- }
420
- function playAudio(source, loop, fromAssets) {
421
- if (loop === void 0) { loop = false; }
422
- if (fromAssets === void 0) { fromAssets = false; }
423
- return callNative(getFuncName$5('playAudio'), { source: source, loop: loop, fromAssets: fromAssets });
424
- }
425
- function stopAudio() {
426
- return callNative(getFuncName$5('stopAudio'), null);
460
+ return callNative(getFuncName$6('deleteBroadcastHook'), { action: action });
427
461
  }
428
462
  function appPrivateMethod(method, params) {
429
463
  var str = '';
@@ -435,7 +469,7 @@ function appPrivateMethod(method, params) {
435
469
  str = String(params);
436
470
  }
437
471
  }
438
- return callNative(getFuncName$5('appPrivateMethod'), { method: method, params: str });
472
+ return callNative(getFuncName$6('appPrivateMethod'), { method: method, params: str });
439
473
  }
440
474
  var app = {
441
475
  startActivity: startActivity,
@@ -448,60 +482,58 @@ var app = {
448
482
  getUserInfo: getUserInfo,
449
483
  getAppList: getAppList,
450
484
  getAppInfo: getAppInfo,
451
- addLocalBroadcastHook: addLocalBroadcastHook,
485
+ setLocalBroadcastHook: setLocalBroadcastHook,
452
486
  deleteLocalBroadcastHook: deleteLocalBroadcastHook,
453
- addBroadcastHook: addBroadcastHook,
487
+ setBroadcastHook: setBroadcastHook,
454
488
  deleteBroadcastHook: deleteBroadcastHook,
455
- playAudio: playAudio,
456
- stopAudio: stopAudio,
457
489
  appPrivateMethod: appPrivateMethod
458
490
  };
459
491
 
460
- var moduleName$4 = 'system';
492
+ var moduleName$5 = 'system';
461
493
  var lifeCycleHookCallbackId = 'lifeCycleHookCallback';
462
- function getFuncName$4(name) {
463
- return moduleName$4 + '_' + name;
494
+ function getFuncName$5(name) {
495
+ return moduleName$5 + '_' + name;
464
496
  }
465
497
  // 获取SDK的版本信息
466
498
  function getSdkVersion() {
467
- return callNative(getFuncName$4('getSdkVersion'), null);
499
+ return callNative(getFuncName$5('getSdkVersion'), null);
468
500
  }
469
501
  // 添加 Activity 的生命周期的回调钩子
470
- function addLifeCycleHook(callback) {
471
- return callWithPersistentCallBack(getFuncName$4('addLifeCycleHook'), { callbackId: lifeCycleHookCallbackId }, lifeCycleHookCallbackId, callback);
502
+ function setLifeCycleHook(callback) {
503
+ return callWithPersistentCallBack(getFuncName$5('setLifeCycleHook'), { callbackId: lifeCycleHookCallbackId }, lifeCycleHookCallbackId, callback);
472
504
  }
473
505
  // 删除生命周期的回调钩子
474
506
  function deleteLifeCycleHook() {
475
507
  deletePersistentCallBack(lifeCycleHookCallbackId);
476
- return callNative(getFuncName$4('deleteLifeCycleHook'), null);
508
+ return callNative(getFuncName$5('deleteLifeCycleHook'), null);
477
509
  }
478
510
  // 声明本页面接收并处理系统级的按键(如:返回、HOME、MENU 键)
479
511
  function enableSystemKey(params) {
480
- return callNative(getFuncName$4('enableSystemKey'), params);
512
+ return callNative(getFuncName$5('enableSystemKey'), params);
481
513
  }
482
514
  // 获取设备信息
483
515
  function getDeviceInfo() {
484
- return callNative(getFuncName$4('getDeviceInfo'), null);
516
+ return callNative(getFuncName$5('getDeviceInfo'), null);
485
517
  }
486
518
  // 获取 android property 的值
487
519
  function getProperty(key) {
488
- return callNative(getFuncName$4('getProperty'), { key: key });
520
+ return callNative(getFuncName$5('getProperty'), { key: key });
489
521
  }
490
522
  // 获取当前设备所处的位置信息
491
523
  function getLocation() {
492
- return callNative(getFuncName$4('getLocation'), null);
524
+ return callNative(getFuncName$5('getLocation'), null);
493
525
  }
494
526
  // 检查 JS-API 是否已经实现
495
527
  function checkApi(apiName) {
496
- return callNative(getFuncName$4('checkApi'), { apiName: apiName });
528
+ return callNative(getFuncName$5('checkApi'), { apiName: apiName });
497
529
  }
498
530
  // 获取显示屏幕信息
499
531
  function getDisplayInfo() {
500
- return callNative(getFuncName$4('getDisplayInfo'), null);
532
+ return callNative(getFuncName$5('getDisplayInfo'), null);
501
533
  }
502
534
  var system = {
503
535
  getSdkVersion: getSdkVersion,
504
- addLifeCycleHook: addLifeCycleHook,
536
+ setLifeCycleHook: setLifeCycleHook,
505
537
  deleteLifeCycleHook: deleteLifeCycleHook,
506
538
  enableSystemKey: enableSystemKey,
507
539
  getDeviceInfo: getDeviceInfo,
@@ -511,21 +543,21 @@ var system = {
511
543
  getDisplayInfo: getDisplayInfo,
512
544
  };
513
545
 
514
- var moduleName$3 = 'storage';
515
- function getFuncName$3(name) {
516
- return moduleName$3 + '_' + name;
546
+ var moduleName$4 = 'storage';
547
+ function getFuncName$4(name) {
548
+ return moduleName$4 + '_' + name;
517
549
  }
518
550
  function setKey(key, value) {
519
- return callNative(getFuncName$3('setKey'), { key: key, value: value });
551
+ return callNative(getFuncName$4('setKey'), { key: key, value: value });
520
552
  }
521
553
  function getKey(key) {
522
- return callNative(getFuncName$3('getKey'), { key: key });
554
+ return callNative(getFuncName$4('getKey'), { key: key });
523
555
  }
524
556
  function deleteKey(key) {
525
- return callNative(getFuncName$3('deleteKey'), { key: key });
557
+ return callNative(getFuncName$4('deleteKey'), { key: key });
526
558
  }
527
559
  function clearAllKeys() {
528
- return callNative(getFuncName$3('clearAllKeys'), null);
560
+ return callNative(getFuncName$4('clearAllKeys'), null);
529
561
  }
530
562
  var storage = {
531
563
  setKey: setKey,
@@ -534,398 +566,358 @@ var storage = {
534
566
  clearAllKeys: clearAllKeys
535
567
  };
536
568
 
537
- var moduleName$2 = 'audio';
538
- function getFuncName$2(name) {
539
- return moduleName$2 + '_' + name;
569
+ var moduleName$3 = 'audio';
570
+ function getFuncName$3(name) {
571
+ return moduleName$3 + '_' + name;
540
572
  }
541
573
  var audioPlayerListenerCallbackId = 'audioPlayerListenerCallbackId';
542
574
  // 播放器,播放新的URL或者本地文件系统的路径
543
575
  function playNew(path) {
544
- return callNative(getFuncName$2('playNew'), { path: path });
576
+ return callNative(getFuncName$3('playNew'), { path: path });
545
577
  }
546
578
  // 播放器,停止播放
547
- function stop() {
548
- return callNative(getFuncName$2('stop'), null);
579
+ function stop$1() {
580
+ return callNative(getFuncName$3('stop'), null);
549
581
  }
550
582
  // 播放器,是否正在播放中
551
- function isPlaying() {
552
- return callNative(getFuncName$2('isPlaying'), null);
583
+ function isPlaying$1() {
584
+ return callNative(getFuncName$3('isPlaying'), null);
553
585
  }
554
586
  // 播放器,是否准备好
555
- function hasPrepared() {
556
- return callNative(getFuncName$2('hasPrepared'), null);
587
+ function hasPrepared$1() {
588
+ return callNative(getFuncName$3('hasPrepared'), null);
557
589
  }
558
590
  // 播放器,获取总时长
559
- function getDuration() {
560
- return callNative(getFuncName$2('getDuration'), null);
591
+ function getDuration$1() {
592
+ return callNative(getFuncName$3('getDuration'), null);
561
593
  }
562
594
  // 播放器,获取当前进度值
563
- function getCurrentPosition() {
564
- return callNative(getFuncName$2('getCurrentPosition'), null);
595
+ function getCurrentPosition$1() {
596
+ return callNative(getFuncName$3('getCurrentPosition'), null);
565
597
  }
566
598
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
567
599
  // 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
568
- function getPlayerState() {
569
- return callNative(getFuncName$2('getPlayerState'), null);
600
+ function getPlayerState$1() {
601
+ return callNative(getFuncName$3('getPlayerState'), null);
570
602
  }
571
603
  // 播放器,暂停播放
572
- function pause() {
573
- return callNative(getFuncName$2('pause'), null);
604
+ function pause$1() {
605
+ return callNative(getFuncName$3('pause'), null);
574
606
  }
575
607
  // 播放器,启动播放或者从暂停恢复播放
576
- function start() {
577
- return callNative(getFuncName$2('start'), null);
608
+ function start$1() {
609
+ return callNative(getFuncName$3('start'), null);
578
610
  }
579
611
  // 播放器,重新播放
580
- function rePlay() {
581
- return callNative(getFuncName$2('rePlay'), null);
612
+ function rePlay$1() {
613
+ return callNative(getFuncName$3('rePlay'), null);
582
614
  }
583
615
  // 播放器,seek
584
- function seekTo(position) {
585
- return callNative(getFuncName$2('seekTo'), { position: Math.floor(position) });
616
+ function seekTo$1(position) {
617
+ return callNative(getFuncName$3('seekTo'), { position: Math.floor(position) });
586
618
  }
587
619
  // 播放器,设置单片循环模式
588
620
  // isLooping: 是否循环播放
589
621
  // silentLoop - 静默循环,默认关闭, 开启之后,部分依靠onCompletion重新播放来实现循环播放的方案下:
590
622
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
591
- function setLooping(isLooping, silentLoop) {
623
+ function setLooping$1(isLooping, silentLoop) {
592
624
  if (silentLoop === void 0) { silentLoop = false; }
593
- return callNative(getFuncName$2('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
625
+ return callNative(getFuncName$3('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
594
626
  }
595
627
  // 设置音量
596
628
  function setVolume(volume) {
597
- return callNative(getFuncName$2('setVolume'), { volume: volume });
629
+ return callNative(getFuncName$3('setVolume'), { volume: volume });
630
+ }
631
+ // 设置播放内核
632
+ // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
633
+ function setPlayerCore$1(core) {
634
+ return callNative(getFuncName$3('setPlayerCore'), { core: core });
598
635
  }
599
636
  // 设置视频播放器的事件回调
600
637
  // 注意: 使用此回调的话,不用时记得使用 deleteListener 注销事件回调
601
- function setListener(callback) {
602
- return callWithPersistentCallBack(getFuncName$2('setListener'), { callbackId: audioPlayerListenerCallbackId }, audioPlayerListenerCallbackId, callback);
638
+ function setListener$1(callback) {
639
+ return callWithPersistentCallBack(getFuncName$3('setListener'), { callbackId: audioPlayerListenerCallbackId }, audioPlayerListenerCallbackId, callback);
603
640
  }
604
641
  // 注销视频播放器的事件回调
605
- function deleteListener() {
642
+ function deleteListener$1() {
606
643
  deletePersistentCallBack(audioPlayerListenerCallbackId);
607
- return callNative(getFuncName$2('deleteListener'), null);
644
+ return callNative(getFuncName$3('deleteListener'), null);
608
645
  }
609
646
  var audio = {
610
647
  playNew: playNew,
611
- stop: stop,
612
- isPlaying: isPlaying,
613
- hasPrepared: hasPrepared,
614
- getDuration: getDuration,
615
- getCurrentPosition: getCurrentPosition,
616
- getPlayerState: getPlayerState,
617
- pause: pause,
618
- start: start,
619
- rePlay: rePlay,
620
- seekTo: seekTo,
621
- setLooping: setLooping,
648
+ stop: stop$1,
649
+ isPlaying: isPlaying$1,
650
+ hasPrepared: hasPrepared$1,
651
+ getDuration: getDuration$1,
652
+ getCurrentPosition: getCurrentPosition$1,
653
+ getPlayerState: getPlayerState$1,
654
+ pause: pause$1,
655
+ start: start$1,
656
+ rePlay: rePlay$1,
657
+ seekTo: seekTo$1,
658
+ setLooping: setLooping$1,
622
659
  setVolume: setVolume,
623
- setListener: setListener,
624
- deleteListener: deleteListener
660
+ setPlayerCore: setPlayerCore$1,
661
+ setListener: setListener$1,
662
+ deleteListener: deleteListener$1
625
663
  };
626
664
 
627
- var moduleName$1 = 'androidView';
628
- function getFuncName$1(name) {
629
- return moduleName$1 + '_' + name;
630
- }
631
- var playerListenerCallbackId = 'playerListenerCallbackId';
632
- // 播放PAG动画
633
- // repeat: 循环次数 -1 表示无限
634
- //
635
- function startPagAni(params) {
636
- return callNative(getFuncName$1('startPagAni'), params);
637
- }
638
- // 停止PAG动画,并消失
639
- function stopPagAni() {
640
- return callNative(getFuncName$1('stopPagAni'), null);
641
- }
642
- // 播报 TTS 文本语音
643
- function sendTts(text, ttsId) {
644
- return callNative(getFuncName$1('sendTts'), { text: text, id: ttsId });
665
+ var moduleName$2 = 'video';
666
+ function getFuncName$2(name) {
667
+ return moduleName$2 + '_' + name;
645
668
  }
646
- // 停止播报 TTS
647
- function stopTts() {
648
- return callNative(getFuncName$1('stopTts'), null);
669
+ var videoPlayerListenerCallbackId = 'videoPlayerListenerCallbackId';
670
+ // 设置视频播放窗口的位置与宽高
671
+ function setVideoLayout(width, height, x, y) {
672
+ return callNative(getFuncName$2('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
649
673
  }
650
- // 流式播报 TTS
651
- function sendStreamTts(text, ttsId, isFirst, isEnd) {
652
- return callNative(getFuncName$1('sendStreamTts'), { text: text, id: ttsId, isFirst: isFirst, isEnd: isEnd });
674
+ // 设置视频窗口是否显示
675
+ function setVideoVisible(show) {
676
+ return callNative(getFuncName$2('setVideoVisible'), { visible: show });
653
677
  }
654
678
  // 播放器,播放新的URL
655
- function playerPlayNewUrl(url) {
656
- return callNative(getFuncName$1('playerPlayNewUrl'), { url: url });
679
+ function playNewUrl(url) {
680
+ return callNative(getFuncName$2('playNewUrl'), { url: url });
681
+ }
682
+ // 播放器,播放新的本地文件路径
683
+ function playNewFile(path) {
684
+ return callNative(getFuncName$2('playNewFile'), { path: path });
657
685
  }
658
686
  // 播放器,停止播放
659
- function playerStop() {
660
- return callNative(getFuncName$1('playerStop'), null);
687
+ function stop() {
688
+ return callNative(getFuncName$2('stop'), null);
661
689
  }
662
690
  // 播放器,暂停播放
663
- function playerPause() {
664
- return callNative(getFuncName$1('playerPause'), null);
691
+ function pause() {
692
+ return callNative(getFuncName$2('pause'), null);
665
693
  }
666
694
  // 播放器,启动播放或者从暂停恢复播放
667
- function playerStart() {
668
- return callNative(getFuncName$1('playerStart'), null);
695
+ function start() {
696
+ return callNative(getFuncName$2('start'), null);
669
697
  }
670
698
  // 播放器,seek
671
- function playerSeekTo(position) {
672
- return callNative(getFuncName$1('playerSeekTo'), { position: Math.floor(position) });
699
+ function seekTo(position) {
700
+ return callNative(getFuncName$2('seekTo'), { position: Math.floor(position) });
673
701
  }
674
702
  // 播放器,是否准备好
675
- function playerHasPrepared() {
676
- return callNative(getFuncName$1('playerHasPrepared'), null);
703
+ function hasPrepared() {
704
+ return callNative(getFuncName$2('hasPrepared'), null);
677
705
  }
678
706
  // 播放器,是否正在播放中
679
- function playerIsPlaying() {
680
- return callNative(getFuncName$1('playerIsPlaying'), null);
707
+ function isPlaying() {
708
+ return callNative(getFuncName$2('isPlaying'), null);
681
709
  }
682
710
  // 播放器,获取总时长
683
- function playerGetDuration() {
684
- return callNative(getFuncName$1('playerGetDuration'), null);
711
+ function getDuration() {
712
+ return callNative(getFuncName$2('getDuration'), null);
685
713
  }
686
714
  // 播放器,获取当前进度值
687
- function playerGetCurrentPosition() {
688
- return callNative(getFuncName$1('playerGetCurrentPosition'), null);
715
+ function getCurrentPosition() {
716
+ return callNative(getFuncName$2('getCurrentPosition'), null);
689
717
  }
690
718
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
691
719
  // 例如:Idle, Initialized, Preparing, Prepared, Started, Paused, Stopped, Completed, Error, End
692
- function playerGetPlayerState() {
693
- return callNative(getFuncName$1('playerGetPlayerState'), null);
694
- }
695
- // 播放器,播放新的本地文件路径
696
- function playerPlayNewFile(path) {
697
- return callNative(getFuncName$1('playerPlayNewFile'), { path: path });
720
+ function getPlayerState() {
721
+ return callNative(getFuncName$2('getPlayerState'), null);
698
722
  }
699
723
  // 播放器,设置单片循环模式
700
724
  // isLooping: 是否循环播放
701
725
  // silentLoop - 静默循环,默认关闭, 开启之后,部分依靠onCompletion重新播放来实现循环播放的方案下:
702
726
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
703
- function playerSetLooping(isLooping, silentLoop) {
727
+ function setLooping(isLooping, silentLoop) {
704
728
  if (silentLoop === void 0) { silentLoop = false; }
705
- return callNative(getFuncName$1('playerSetLooping'), { isLooping: isLooping, silentLoop: silentLoop });
729
+ return callNative(getFuncName$2('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
706
730
  }
707
731
  // 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
708
- function playerSetAutoWakeLock(autoWakeLock) {
709
- return callNative(getFuncName$1('playerSetAutoWakeLock'), { autoWakeLock: autoWakeLock });
732
+ function setAutoWakeLock(autoWakeLock) {
733
+ return callNative(getFuncName$2('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
710
734
  }
711
735
  // 播放器,重新播放
712
- function playerRePlay() {
713
- return callNative(getFuncName$1('playerRePlay'), null);
736
+ function rePlay() {
737
+ return callNative(getFuncName$2('rePlay'), null);
714
738
  }
715
739
  // 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
716
- function playerSetPlayWhenReady(playWhenReady) {
740
+ function setPlayWhenReady(playWhenReady) {
717
741
  if (playWhenReady === void 0) { playWhenReady = true; }
718
- return callNative(getFuncName$1('playerSetPlayWhenReady'), { playWhenReady: playWhenReady });
742
+ return callNative(getFuncName$2('setPlayWhenReady'), { playWhenReady: playWhenReady });
719
743
  }
720
744
  // 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
721
745
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
722
- function playerGetPlayerCore() {
723
- return callNative(getFuncName$1('playerGetPlayerCore'), null);
746
+ function getPlayerCore() {
747
+ return callNative(getFuncName$2('getPlayerCore'), null);
724
748
  }
725
749
  // 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
726
750
  // 值: MediaPlayer, SocPlayer, ExoPlayer
727
- function playerGetRealPlayerCore() {
728
- return callNative(getFuncName$1('playerGetRealPlayerCore'), null);
751
+ function getRealPlayerCore() {
752
+ return callNative(getFuncName$2('getRealPlayerCore'), null);
753
+ }
754
+ // 设置播放内核
755
+ // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
756
+ function setPlayerCore(core) {
757
+ return callNative(getFuncName$2('setPlayerCore'), { core: core });
729
758
  }
730
759
  // 设置视频播放器的事件回调
731
- // 注意: 使用此回调的话,不用时记得使用 playerDeleteListener 注销事件回调
732
- function playerSetListener(callback) {
733
- return callWithPersistentCallBack(getFuncName$1('playerSetListener'), { callbackId: playerListenerCallbackId }, playerListenerCallbackId, callback);
760
+ // 注意: 使用此回调的话,不用时记得使用 deleteListener 注销事件回调
761
+ function setListener(callback) {
762
+ return callWithPersistentCallBack(getFuncName$2('setListener'), { callbackId: videoPlayerListenerCallbackId }, videoPlayerListenerCallbackId, callback);
734
763
  }
735
764
  // 注销视频播放器的事件回调
736
- function playerDeleteListener() {
737
- deletePersistentCallBack(playerListenerCallbackId);
738
- return callNative(getFuncName$1('playerDeleteListener'), null);
739
- }
740
- // 设置视频播放窗口的位置与宽高
741
- function setVideoLayout(width, height, x, y) {
742
- return callNative(getFuncName$1('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
743
- }
744
- // 设置视频窗口是否显示
745
- function setVideoVisible(show) {
746
- return callNative(getFuncName$1('setVideoVisible'), { visible: show });
747
- }
748
- // 设置背景
749
- // needUpdateColor : 是否更新颜色
750
- // color : 颜色值,例如 0xFFFF0000表示红色,格式为 ARGB
751
- // needUpdateImage : 是否更新背景图
752
- // imageUrl: 背景图的URL
753
- function setBackground(needUpdateColor, color, needUpdateImage, imageUrl) {
754
- return callNative(getFuncName$1('setBackground'), { updateColorFlag: needUpdateColor, updateImageFlag: needUpdateImage, color: Math.floor(color), imageUrl: imageUrl });
755
- }
756
- // 清除背景
757
- function clearBackground() {
758
- return callNative(getFuncName$1('clearBackground'), null);
759
- }
760
- // 显示语音文本提示条, tips文本中如果带 # 字符,会把 # 字符显示成麦克风图标
761
- function showVoiceTipsBar(tips) {
762
- if (tips === void 0) { tips = ''; }
763
- return callNative(getFuncName$1('showVoiceTipsBar'), { tips: tips });
764
- }
765
- // 隐藏语音文本提示条
766
- function hideVoiceTipsBar() {
767
- return callNative(getFuncName$1('hideVoiceTipsBar'), null);
765
+ function deleteListener() {
766
+ deletePersistentCallBack(videoPlayerListenerCallbackId);
767
+ return callNative(getFuncName$2('deleteListener'), null);
768
768
  }
769
- var androidView = {
770
- startPagAni: startPagAni,
771
- stopPagAni: stopPagAni,
772
- sendTts: sendTts,
773
- stopTts: stopTts,
774
- sendStreamTts: sendStreamTts,
775
- playerPlayNewUrl: playerPlayNewUrl,
776
- playerStop: playerStop,
777
- playerPause: playerPause,
778
- playerStart: playerStart,
779
- playerSeekTo: playerSeekTo,
780
- playerHasPrepared: playerHasPrepared,
781
- playerIsPlaying: playerIsPlaying,
782
- playerGetDuration: playerGetDuration,
783
- playerGetCurrentPosition: playerGetCurrentPosition,
784
- playerGetPlayerState: playerGetPlayerState,
785
- playerPlayNewFile: playerPlayNewFile,
786
- playerSetLooping: playerSetLooping,
787
- playerSetAutoWakeLock: playerSetAutoWakeLock,
788
- playerRePlay: playerRePlay,
789
- playerSetPlayWhenReady: playerSetPlayWhenReady,
790
- playerGetPlayerCore: playerGetPlayerCore,
791
- playerGetRealPlayerCore: playerGetRealPlayerCore,
792
- playerSetListener: playerSetListener,
793
- playerDeleteListener: playerDeleteListener,
769
+ var video = {
794
770
  setVideoLayout: setVideoLayout,
795
771
  setVideoVisible: setVideoVisible,
796
- setBackground: setBackground,
797
- clearBackground: clearBackground,
798
- showVoiceTipsBar: showVoiceTipsBar,
799
- hideVoiceTipsBar: hideVoiceTipsBar,
772
+ playNewUrl: playNewUrl,
773
+ playNewFile: playNewFile,
774
+ stop: stop,
775
+ pause: pause,
776
+ start: start,
777
+ seekTo: seekTo,
778
+ hasPrepared: hasPrepared,
779
+ isPlaying: isPlaying,
780
+ getDuration: getDuration,
781
+ getCurrentPosition: getCurrentPosition,
782
+ getPlayerState: getPlayerState,
783
+ setLooping: setLooping,
784
+ setAutoWakeLock: setAutoWakeLock,
785
+ rePlay: rePlay,
786
+ setPlayWhenReady: setPlayWhenReady,
787
+ getPlayerCore: getPlayerCore,
788
+ getRealPlayerCore: getRealPlayerCore,
789
+ setPlayerCore: setPlayerCore,
790
+ setListener: setListener,
791
+ deleteListener: deleteListener,
800
792
  };
801
793
 
802
- var moduleName = 'file';
803
- function getFuncName(name) {
804
- return moduleName + '_' + name;
794
+ var moduleName$1 = 'fs';
795
+ function getFuncName$1(name) {
796
+ return moduleName$1 + '_' + name;
805
797
  }
806
798
  // 读取文件并返回文件的所有内容
807
799
  // 参数:
808
800
  // path: 读取文件的路径
809
- // base64Flag: 是否以base64编码方式返回, 如果读取文件文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
801
+ // base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
810
802
  function readAllContent(path, base64Flag) {
811
803
  if (base64Flag === void 0) { base64Flag = false; }
812
- return callNative(getFuncName('readAllContent'), { path: path, base64Flag: base64Flag });
804
+ return callNative(getFuncName$1('readAllContent'), { path: path, base64Flag: base64Flag });
813
805
  }
814
806
  // 将内容全部写入文件
815
807
  // 参数:
816
808
  // path: 写入文件的路径
817
809
  // content: 写入的内容,字符串,如果要写入二进制,应该先编码成 base64 字符串再传入
818
- // base64Flag: 是否以base64编码方式传输content, 如果写文件文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
810
+ // base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
819
811
  function writeAllContent(path, content, base64Flag) {
820
812
  if (base64Flag === void 0) { base64Flag = false; }
821
- return callNative(getFuncName('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
813
+ return callNative(getFuncName$1('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
822
814
  }
823
815
  // 获取应用基本目录的全路径名
824
- function getBaseDir() {
825
- return callNative(getFuncName('getBaseDir'), null);
816
+ function getAppBaseDir() {
817
+ return callNative(getFuncName$1('getAppBaseDir'), null);
826
818
  }
827
819
  // 获取 Cache 目录的全路径名
828
- function getCacheDir() {
829
- return callNative(getFuncName('getCacheDir'), null);
820
+ function getAppCacheDir() {
821
+ return callNative(getFuncName$1('getAppCacheDir'), null);
830
822
  }
831
823
  // 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
832
824
  // 参数:
833
825
  // fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
834
826
  function makeCacheFile(fileName) {
835
827
  if (fileName === void 0) { fileName = ''; }
836
- return callNative(getFuncName('makeCacheFile'), { fileName: fileName });
828
+ return callNative(getFuncName$1('makeCacheFile'), { fileName: fileName });
837
829
  }
838
830
  // 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
839
831
  // 参数:
840
832
  // fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
841
833
  function makeNormalFile(fileName) {
842
834
  if (fileName === void 0) { fileName = ''; }
843
- return callNative(getFuncName('makeNormalFile'), { fileName: fileName });
835
+ return callNative(getFuncName$1('makeNormalFile'), { fileName: fileName });
844
836
  }
845
837
  // 检测一个文件或者目录是否存在
846
838
  // 参数:
847
839
  // path: 指定路径
848
840
  function exists(path) {
849
- return callNative(getFuncName('exists'), { path: path });
841
+ return callNative(getFuncName$1('exists'), { path: path });
850
842
  }
851
843
  // 检测一个路径是否为一个普通文件
852
844
  // 参数:
853
845
  // path: 指定路径
854
846
  function isFile(path) {
855
- return callNative(getFuncName('isFile'), { path: path });
847
+ return callNative(getFuncName$1('isFile'), { path: path });
856
848
  }
857
849
  // 检测一个路径是否为一个目录
858
850
  // 参数:
859
851
  // path: 指定路径
860
852
  function isDirectory(path) {
861
- return callNative(getFuncName('isDirectory'), { path: path });
853
+ return callNative(getFuncName$1('isDirectory'), { path: path });
862
854
  }
863
855
  // 检测一个路径表示的文件或目录 是否是隐藏的
864
856
  // 参数:
865
857
  // path: 指定路径
866
858
  function isHidden(path) {
867
- return callNative(getFuncName('isHidden'), { path: path });
859
+ return callNative(getFuncName$1('isHidden'), { path: path });
868
860
  }
869
861
  // 检测一个路径表示的文件或目录 是否可读
870
862
  // 参数:
871
863
  // path: 指定路径
872
864
  function canRead(path) {
873
- return callNative(getFuncName('canRead'), { path: path });
865
+ return callNative(getFuncName$1('canRead'), { path: path });
874
866
  }
875
867
  // 检测一个路径表示的文件或目录 是否可写
876
868
  // 参数:
877
869
  // path: 指定路径
878
870
  function canWrite(path) {
879
- return callNative(getFuncName('canWrite'), { path: path });
871
+ return callNative(getFuncName$1('canWrite'), { path: path });
880
872
  }
881
873
  // 检测一个路径表示的文件或目录 是否可执行
882
874
  // 参数:
883
875
  // path: 指定路径
884
876
  function canExecute(path) {
885
- return callNative(getFuncName('canExecute'), { path: path });
877
+ return callNative(getFuncName$1('canExecute'), { path: path });
886
878
  }
887
879
  // 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
888
880
  // 参数:
889
881
  // path: 指定路径
890
882
  function lastModified(path) {
891
- return callNative(getFuncName('lastModified'), { path: path });
883
+ return callNative(getFuncName$1('lastModified'), { path: path });
892
884
  }
893
885
  // 删除文件
894
886
  // 参数:
895
887
  // path: 指定路径
896
888
  function deleteIt(path) {
897
- return callNative(getFuncName('delete'), { path: path });
889
+ return callNative(getFuncName$1('delete'), { path: path });
898
890
  }
899
891
  // 新建目录
900
892
  // 参数:
901
893
  // path: 指定路径
902
894
  function mkdir(path) {
903
- return callNative(getFuncName('mkdir'), { path: path });
895
+ return callNative(getFuncName$1('mkdir'), { path: path });
904
896
  }
905
897
  // 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
906
898
  // 参数:
907
899
  // path: 指定路径
908
900
  function mkdirs(path) {
909
- return callNative(getFuncName('mkdirs'), { path: path });
901
+ return callNative(getFuncName$1('mkdirs'), { path: path });
910
902
  }
911
903
  // 改名
912
904
  // 参数:
913
905
  // from: 指定源路径
914
906
  // to: 指定目标路径
915
907
  function rename(from, to) {
916
- return callNative(getFuncName('rename'), { from: from, to: to });
908
+ return callNative(getFuncName$1('rename'), { from: from, to: to });
917
909
  }
918
910
  // 将相对路径的转换为全路径
919
911
  // 参数:
920
912
  // path: 指定路径
921
913
  function getAbsolutePath(path) {
922
- return callNative(getFuncName('getAbsolutePath'), { path: path });
914
+ return callNative(getFuncName$1('getAbsolutePath'), { path: path });
923
915
  }
924
916
  // 指定路径创建新文件
925
917
  // 参数:
926
918
  // path: 指定路径
927
919
  function createNewFile(path) {
928
- return callNative(getFuncName('createNewFile'), { path: path });
920
+ return callNative(getFuncName$1('createNewFile'), { path: path });
929
921
  }
930
922
  // 设置可读属性
931
923
  // 参数:
@@ -933,7 +925,7 @@ function createNewFile(path) {
933
925
  // value: 是否可读
934
926
  function setReadable(path, value) {
935
927
  if (value === void 0) { value = true; }
936
- return callNative(getFuncName('setReadable'), { path: path, value: value });
928
+ return callNative(getFuncName$1('setReadable'), { path: path, value: value });
937
929
  }
938
930
  // 设置可写属性
939
931
  // 参数:
@@ -941,7 +933,7 @@ function setReadable(path, value) {
941
933
  // value: 是否可写
942
934
  function setWritable(path, value) {
943
935
  if (value === void 0) { value = true; }
944
- return callNative(getFuncName('setWritable'), { path: path, value: value });
936
+ return callNative(getFuncName$1('setWritable'), { path: path, value: value });
945
937
  }
946
938
  // 设置可执行属性
947
939
  // 参数:
@@ -949,7 +941,7 @@ function setWritable(path, value) {
949
941
  // value: 是否可执行
950
942
  function setExecutable(path, value) {
951
943
  if (value === void 0) { value = true; }
952
- return callNative(getFuncName('setExecutable'), { path: path, value: value });
944
+ return callNative(getFuncName$1('setExecutable'), { path: path, value: value });
953
945
  }
954
946
  // 设置文件最后修改的时间
955
947
  // 参数:
@@ -957,19 +949,19 @@ function setExecutable(path, value) {
957
949
  // value: 时间戳
958
950
  function setLastModified(path, value) {
959
951
  if (value === void 0) { value = 0; }
960
- return callNative(getFuncName('setLastModified'), { path: path, value: value });
952
+ return callNative(getFuncName$1('setLastModified'), { path: path, value: value });
961
953
  }
962
954
  // 读取目录,返回该目录下的文件列表
963
955
  // 参数:
964
956
  // path: 指定路径
965
957
  function list(path) {
966
- return callNative(getFuncName('list'), { path: path });
958
+ return callNative(getFuncName$1('list'), { path: path });
967
959
  }
968
- var file = {
960
+ var fs = {
969
961
  readAllContent: readAllContent,
970
962
  writeAllContent: writeAllContent,
971
- getBaseDir: getBaseDir,
972
- getCacheDir: getCacheDir,
963
+ getAppBaseDir: getAppBaseDir,
964
+ getAppCacheDir: getAppCacheDir,
973
965
  makeCacheFile: makeCacheFile,
974
966
  makeNormalFile: makeNormalFile,
975
967
  exists: exists,
@@ -993,7 +985,82 @@ var file = {
993
985
  list: list
994
986
  };
995
987
 
996
- window['appNativeCall'] = function apkNativeCall(str) {
988
+ var moduleName = 'nativeView';
989
+ function getFuncName(name) {
990
+ return moduleName + '_' + name;
991
+ }
992
+ // 播放PAG动画
993
+ // repeat: 循环次数 -1 表示无限
994
+ //
995
+ function startNewPagAni(params) {
996
+ return callNative(getFuncName('startNewPagAni'), params);
997
+ }
998
+ // 停止PAG动画,并消失
999
+ function stopPagAni() {
1000
+ return callNative(getFuncName('stopPagAni'), null);
1001
+ }
1002
+ function setPagVisibility(visible) {
1003
+ if (visible === void 0) { visible = true; }
1004
+ var value = true;
1005
+ if (typeof visible != 'boolean') {
1006
+ if (typeof visible == 'string') {
1007
+ var str = visible.toLowerCase();
1008
+ value = (str == 'false' || !str) ? false : true;
1009
+ }
1010
+ else {
1011
+ value = visible ? true : false;
1012
+ }
1013
+ }
1014
+ else {
1015
+ value = visible;
1016
+ }
1017
+ return callNative(getFuncName('setPagVisibility'), { visible: value });
1018
+ }
1019
+ function setPagXY(x, y) {
1020
+ return callNative(getFuncName('setPagXY'), { x: x, y: y });
1021
+ }
1022
+ // // 播报 TTS 文本语音
1023
+ // export function sendTts(text: string, ttsId: string): Promise<any> {
1024
+ // return callNative(getFuncName('sendTts'), { text, id: ttsId });
1025
+ // }
1026
+ // // 停止播报 TTS
1027
+ // export function stopTts(): Promise<any> {
1028
+ // return callNative(getFuncName('stopTts'), null);
1029
+ // }
1030
+ // // 流式播报 TTS
1031
+ // export function sendStreamTts(
1032
+ // text: string,
1033
+ // ttsId: string,
1034
+ // isFirst: boolean,
1035
+ // isEnd: boolean
1036
+ // ): Promise<any> {
1037
+ // return callNative(getFuncName('sendStreamTts'), { text, id: ttsId, isFirst, isEnd });
1038
+ // }
1039
+ // 设置背景
1040
+ // needUpdateColor : 是否更新颜色
1041
+ // color : 颜色值,例如 0xFFFF0000表示红色,格式为 ARGB
1042
+ // needUpdateImage : 是否更新背景图
1043
+ // imageUrl: 背景图的URL
1044
+ // export function setBackground(needUpdateColor: boolean, color: number, needUpdateImage: boolean, imageUrl: string) : Promise<any> {
1045
+ // return callNative(getFuncName('setBackground'), {updateColorFlag: needUpdateColor, updateImageFlag: needUpdateImage, color: Math.floor(color), imageUrl});
1046
+ // }
1047
+ // // 清除背景
1048
+ // export function clearBackground() : Promise<any> {
1049
+ // return callNative(getFuncName('clearBackground'), null);
1050
+ // }
1051
+ var nativeView = {
1052
+ startNewPagAni: startNewPagAni,
1053
+ stopPagAni: stopPagAni,
1054
+ setPagVisibility: setPagVisibility,
1055
+ setPagXY: setPagXY,
1056
+ // sendTts,
1057
+ // stopTts,
1058
+ // sendStreamTts,
1059
+ // setBackground,
1060
+ // clearBackground,
1061
+ };
1062
+
1063
+ function apkNativeCallJs(str) {
997
1064
  var res = null;
998
1065
  //console.log('str1=' + str);
999
1066
  try {
@@ -1021,19 +1088,25 @@ window['appNativeCall'] = function apkNativeCall(str) {
1021
1088
  onCommandFromApp(res['cmd'], res['data']);
1022
1089
  }
1023
1090
  }
1024
- };
1091
+ }
1025
1092
  function isRunInAppBrowser() {
1026
1093
  return window['_liteNativeApi'] ? true : false;
1027
1094
  }
1095
+ function init() {
1096
+ window['appNativeCall'] = apkNativeCallJs;
1097
+ initSDK();
1098
+ }
1028
1099
  var index = {
1100
+ init: init,
1029
1101
  network: network,
1030
1102
  app: app,
1031
1103
  system: system,
1032
1104
  storage: storage,
1033
- androidView: androidView,
1034
1105
  audio: audio,
1035
- file: file,
1106
+ video: video,
1107
+ nativeView: nativeView,
1108
+ fs: fs,
1036
1109
  isRunInAppBrowser: isRunInAppBrowser
1037
1110
  };
1038
1111
 
1039
- export { index as default, isRunInAppBrowser, setAppCommandCallback, unsetAppCommandCallback };
1112
+ export { index as default, init, isRunInAppBrowser, setAppCommandCallback, unsetAppCommandCallback };