@ccos/ccsdk-lite 1.0.4 → 1.0.6

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.
@@ -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,346 @@ 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 });
598
630
  }
599
631
  // 设置视频播放器的事件回调
600
632
  // 注意: 使用此回调的话,不用时记得使用 deleteListener 注销事件回调
601
- function setListener(callback) {
602
- return callWithPersistentCallBack(getFuncName$2('setListener'), { callbackId: audioPlayerListenerCallbackId }, audioPlayerListenerCallbackId, callback);
633
+ function setListener$1(callback) {
634
+ return callWithPersistentCallBack(getFuncName$3('setListener'), { callbackId: audioPlayerListenerCallbackId }, audioPlayerListenerCallbackId, callback);
603
635
  }
604
636
  // 注销视频播放器的事件回调
605
- function deleteListener() {
637
+ function deleteListener$1() {
606
638
  deletePersistentCallBack(audioPlayerListenerCallbackId);
607
- return callNative(getFuncName$2('deleteListener'), null);
639
+ return callNative(getFuncName$3('deleteListener'), null);
608
640
  }
609
641
  var audio = {
610
642
  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,
643
+ stop: stop$1,
644
+ isPlaying: isPlaying$1,
645
+ hasPrepared: hasPrepared$1,
646
+ getDuration: getDuration$1,
647
+ getCurrentPosition: getCurrentPosition$1,
648
+ getPlayerState: getPlayerState$1,
649
+ pause: pause$1,
650
+ start: start$1,
651
+ rePlay: rePlay$1,
652
+ seekTo: seekTo$1,
653
+ setLooping: setLooping$1,
622
654
  setVolume: setVolume,
623
- setListener: setListener,
624
- deleteListener: deleteListener
655
+ setListener: setListener$1,
656
+ deleteListener: deleteListener$1
625
657
  };
626
658
 
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 });
659
+ var moduleName$2 = 'video';
660
+ function getFuncName$2(name) {
661
+ return moduleName$2 + '_' + name;
645
662
  }
646
- // 停止播报 TTS
647
- function stopTts() {
648
- return callNative(getFuncName$1('stopTts'), null);
663
+ var videoPlayerListenerCallbackId = 'videoPlayerListenerCallbackId';
664
+ // 设置视频播放窗口的位置与宽高
665
+ function setVideoLayout(width, height, x, y) {
666
+ return callNative(getFuncName$2('setVideoLayout'), { x: Number(x), y: Number(y), w: Number(width), h: Number(height) });
649
667
  }
650
- // 流式播报 TTS
651
- function sendStreamTts(text, ttsId, isFirst, isEnd) {
652
- return callNative(getFuncName$1('sendStreamTts'), { text: text, id: ttsId, isFirst: isFirst, isEnd: isEnd });
668
+ // 设置视频窗口是否显示
669
+ function setVideoVisible(show) {
670
+ return callNative(getFuncName$2('setVideoVisible'), { visible: show });
653
671
  }
654
672
  // 播放器,播放新的URL
655
- function playerPlayNewUrl(url) {
656
- return callNative(getFuncName$1('playerPlayNewUrl'), { url: url });
673
+ function playNewUrl(url) {
674
+ return callNative(getFuncName$2('playNewUrl'), { url: url });
675
+ }
676
+ // 播放器,播放新的本地文件路径
677
+ function playNewFile(path) {
678
+ return callNative(getFuncName$2('playNewFile'), { path: path });
657
679
  }
658
680
  // 播放器,停止播放
659
- function playerStop() {
660
- return callNative(getFuncName$1('playerStop'), null);
681
+ function stop() {
682
+ return callNative(getFuncName$2('stop'), null);
661
683
  }
662
684
  // 播放器,暂停播放
663
- function playerPause() {
664
- return callNative(getFuncName$1('playerPause'), null);
685
+ function pause() {
686
+ return callNative(getFuncName$2('pause'), null);
665
687
  }
666
688
  // 播放器,启动播放或者从暂停恢复播放
667
- function playerStart() {
668
- return callNative(getFuncName$1('playerStart'), null);
689
+ function start() {
690
+ return callNative(getFuncName$2('start'), null);
669
691
  }
670
692
  // 播放器,seek
671
- function playerSeekTo(position) {
672
- return callNative(getFuncName$1('playerSeekTo'), { position: Math.floor(position) });
693
+ function seekTo(position) {
694
+ return callNative(getFuncName$2('seekTo'), { position: Math.floor(position) });
673
695
  }
674
696
  // 播放器,是否准备好
675
- function playerHasPrepared() {
676
- return callNative(getFuncName$1('playerHasPrepared'), null);
697
+ function hasPrepared() {
698
+ return callNative(getFuncName$2('hasPrepared'), null);
677
699
  }
678
700
  // 播放器,是否正在播放中
679
- function playerIsPlaying() {
680
- return callNative(getFuncName$1('playerIsPlaying'), null);
701
+ function isPlaying() {
702
+ return callNative(getFuncName$2('isPlaying'), null);
681
703
  }
682
704
  // 播放器,获取总时长
683
- function playerGetDuration() {
684
- return callNative(getFuncName$1('playerGetDuration'), null);
705
+ function getDuration() {
706
+ return callNative(getFuncName$2('getDuration'), null);
685
707
  }
686
708
  // 播放器,获取当前进度值
687
- function playerGetCurrentPosition() {
688
- return callNative(getFuncName$1('playerGetCurrentPosition'), null);
709
+ function getCurrentPosition() {
710
+ return callNative(getFuncName$2('getCurrentPosition'), null);
689
711
  }
690
712
  // 播放器,获取播放状态,返回的value为字符串来标识播放状态
691
713
  // 例如: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 });
714
+ function getPlayerState() {
715
+ return callNative(getFuncName$2('getPlayerState'), null);
698
716
  }
699
717
  // 播放器,设置单片循环模式
700
718
  // isLooping: 是否循环播放
701
719
  // silentLoop - 静默循环,默认关闭, 开启之后,部分依靠onCompletion重新播放来实现循环播放的方案下:
702
720
  // 会无感知重播,即重播时,不会调idle/ preparing/ prepared等开始播放之前的状态)
703
- function playerSetLooping(isLooping, silentLoop) {
721
+ function setLooping(isLooping, silentLoop) {
704
722
  if (silentLoop === void 0) { silentLoop = false; }
705
- return callNative(getFuncName$1('playerSetLooping'), { isLooping: isLooping, silentLoop: silentLoop });
723
+ return callNative(getFuncName$2('setLooping'), { isLooping: isLooping, silentLoop: silentLoop });
706
724
  }
707
725
  // 播放器,设置自动屏保锁,即:开始或恢复播放->锁屏保,停止或暂停播放->释放屏保锁 默认关闭
708
- function playerSetAutoWakeLock(autoWakeLock) {
709
- return callNative(getFuncName$1('playerSetAutoWakeLock'), { autoWakeLock: autoWakeLock });
726
+ function setAutoWakeLock(autoWakeLock) {
727
+ return callNative(getFuncName$2('setAutoWakeLock'), { autoWakeLock: autoWakeLock });
710
728
  }
711
729
  // 播放器,重新播放
712
- function playerRePlay() {
713
- return callNative(getFuncName$1('playerRePlay'), null);
730
+ function rePlay() {
731
+ return callNative(getFuncName$2('rePlay'), null);
714
732
  }
715
733
  // 播放器,设置是否自动播放,即 play ready 后音视频自动播放 默认开启
716
- function playerSetPlayWhenReady(playWhenReady) {
734
+ function setPlayWhenReady(playWhenReady) {
717
735
  if (playWhenReady === void 0) { playWhenReady = true; }
718
- return callNative(getFuncName$1('playerSetPlayWhenReady'), { playWhenReady: playWhenReady });
736
+ return callNative(getFuncName$2('setPlayWhenReady'), { playWhenReady: playWhenReady });
719
737
  }
720
738
  // 获取当前设置的播放内核, 有可能会返回 DefaultPlayer
721
739
  // 值: DefaultPlayer, MediaPlayer, SocPlayer, ExoPlayer
722
- function playerGetPlayerCore() {
723
- return callNative(getFuncName$1('playerGetPlayerCore'), null);
740
+ function getPlayerCore() {
741
+ return callNative(getFuncName$2('getPlayerCore'), null);
724
742
  }
725
743
  // 获取实际的播放内核, 部分内核如:最佳内核,实际上是在各个内核中进行选择,不会返回 DefaultPlayer
726
744
  // 值: MediaPlayer, SocPlayer, ExoPlayer
727
- function playerGetRealPlayerCore() {
728
- return callNative(getFuncName$1('playerGetRealPlayerCore'), null);
745
+ function getRealPlayerCore() {
746
+ return callNative(getFuncName$2('getRealPlayerCore'), null);
729
747
  }
730
748
  // 设置视频播放器的事件回调
731
- // 注意: 使用此回调的话,不用时记得使用 playerDeleteListener 注销事件回调
732
- function playerSetListener(callback) {
733
- return callWithPersistentCallBack(getFuncName$1('playerSetListener'), { callbackId: playerListenerCallbackId }, playerListenerCallbackId, callback);
749
+ // 注意: 使用此回调的话,不用时记得使用 deleteListener 注销事件回调
750
+ function setListener(callback) {
751
+ return callWithPersistentCallBack(getFuncName$2('setListener'), { callbackId: videoPlayerListenerCallbackId }, videoPlayerListenerCallbackId, callback);
734
752
  }
735
753
  // 注销视频播放器的事件回调
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);
754
+ function deleteListener() {
755
+ deletePersistentCallBack(videoPlayerListenerCallbackId);
756
+ return callNative(getFuncName$2('deleteListener'), null);
768
757
  }
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,
758
+ var video = {
794
759
  setVideoLayout: setVideoLayout,
795
760
  setVideoVisible: setVideoVisible,
796
- setBackground: setBackground,
797
- clearBackground: clearBackground,
798
- showVoiceTipsBar: showVoiceTipsBar,
799
- hideVoiceTipsBar: hideVoiceTipsBar,
761
+ playNewUrl: playNewUrl,
762
+ playNewFile: playNewFile,
763
+ stop: stop,
764
+ pause: pause,
765
+ start: start,
766
+ seekTo: seekTo,
767
+ hasPrepared: hasPrepared,
768
+ isPlaying: isPlaying,
769
+ getDuration: getDuration,
770
+ getCurrentPosition: getCurrentPosition,
771
+ getPlayerState: getPlayerState,
772
+ setLooping: setLooping,
773
+ setAutoWakeLock: setAutoWakeLock,
774
+ rePlay: rePlay,
775
+ setPlayWhenReady: setPlayWhenReady,
776
+ getPlayerCore: getPlayerCore,
777
+ getRealPlayerCore: getRealPlayerCore,
778
+ setListener: setListener,
779
+ deleteListener: deleteListener,
800
780
  };
801
781
 
802
- var moduleName = 'file';
803
- function getFuncName(name) {
804
- return moduleName + '_' + name;
782
+ var moduleName$1 = 'fs';
783
+ function getFuncName$1(name) {
784
+ return moduleName$1 + '_' + name;
805
785
  }
806
786
  // 读取文件并返回文件的所有内容
807
787
  // 参数:
808
788
  // path: 读取文件的路径
809
- // base64Flag: 是否以base64编码方式返回, 如果读取文件文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
789
+ // base64Flag: 是否以base64编码方式返回, 如果读取文本文件,则应该设置 base64Flag = false,如果读取二进制文件,则应该设置 base64Flag = true
810
790
  function readAllContent(path, base64Flag) {
811
791
  if (base64Flag === void 0) { base64Flag = false; }
812
- return callNative(getFuncName('readAllContent'), { path: path, base64Flag: base64Flag });
792
+ return callNative(getFuncName$1('readAllContent'), { path: path, base64Flag: base64Flag });
813
793
  }
814
794
  // 将内容全部写入文件
815
795
  // 参数:
816
796
  // path: 写入文件的路径
817
797
  // content: 写入的内容,字符串,如果要写入二进制,应该先编码成 base64 字符串再传入
818
- // base64Flag: 是否以base64编码方式传输content, 如果写文件文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
798
+ // base64Flag: 是否以base64编码方式传输content, 如果写文本文件,则应该设置 base64Flag = false,如果写入二进制文件,则应该设置 base64Flag = true
819
799
  function writeAllContent(path, content, base64Flag) {
820
800
  if (base64Flag === void 0) { base64Flag = false; }
821
- return callNative(getFuncName('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
801
+ return callNative(getFuncName$1('writeAllContent'), { path: path, content: content, base64Flag: base64Flag });
822
802
  }
823
803
  // 获取应用基本目录的全路径名
824
- function getBaseDir() {
825
- return callNative(getFuncName('getBaseDir'), null);
804
+ function getAppBaseDir() {
805
+ return callNative(getFuncName$1('getAppBaseDir'), null);
826
806
  }
827
807
  // 获取 Cache 目录的全路径名
828
- function getCacheDir() {
829
- return callNative(getFuncName('getCacheDir'), null);
808
+ function getAppCacheDir() {
809
+ return callNative(getFuncName$1('getAppCacheDir'), null);
830
810
  }
831
811
  // 构建一个临时文件名,返回该文件的绝对路径的全文件路径名
832
812
  // 参数:
833
813
  // fileName: 指定临时文件的基本名,如果不指定,会默认随机生成一个文件名
834
814
  function makeCacheFile(fileName) {
835
815
  if (fileName === void 0) { fileName = ''; }
836
- return callNative(getFuncName('makeCacheFile'), { fileName: fileName });
816
+ return callNative(getFuncName$1('makeCacheFile'), { fileName: fileName });
837
817
  }
838
818
  // 构建一个正常文件名,返回该文件的绝对路径的全文件路径名
839
819
  // 参数:
840
820
  // fileName: 指定文件的基本名,如果不指定,会默认随机生成一个文件名
841
821
  function makeNormalFile(fileName) {
842
822
  if (fileName === void 0) { fileName = ''; }
843
- return callNative(getFuncName('makeNormalFile'), { fileName: fileName });
823
+ return callNative(getFuncName$1('makeNormalFile'), { fileName: fileName });
844
824
  }
845
825
  // 检测一个文件或者目录是否存在
846
826
  // 参数:
847
827
  // path: 指定路径
848
828
  function exists(path) {
849
- return callNative(getFuncName('exists'), { path: path });
829
+ return callNative(getFuncName$1('exists'), { path: path });
850
830
  }
851
831
  // 检测一个路径是否为一个普通文件
852
832
  // 参数:
853
833
  // path: 指定路径
854
834
  function isFile(path) {
855
- return callNative(getFuncName('isFile'), { path: path });
835
+ return callNative(getFuncName$1('isFile'), { path: path });
856
836
  }
857
837
  // 检测一个路径是否为一个目录
858
838
  // 参数:
859
839
  // path: 指定路径
860
840
  function isDirectory(path) {
861
- return callNative(getFuncName('isDirectory'), { path: path });
841
+ return callNative(getFuncName$1('isDirectory'), { path: path });
862
842
  }
863
843
  // 检测一个路径表示的文件或目录 是否是隐藏的
864
844
  // 参数:
865
845
  // path: 指定路径
866
846
  function isHidden(path) {
867
- return callNative(getFuncName('isHidden'), { path: path });
847
+ return callNative(getFuncName$1('isHidden'), { path: path });
868
848
  }
869
849
  // 检测一个路径表示的文件或目录 是否可读
870
850
  // 参数:
871
851
  // path: 指定路径
872
852
  function canRead(path) {
873
- return callNative(getFuncName('canRead'), { path: path });
853
+ return callNative(getFuncName$1('canRead'), { path: path });
874
854
  }
875
855
  // 检测一个路径表示的文件或目录 是否可写
876
856
  // 参数:
877
857
  // path: 指定路径
878
858
  function canWrite(path) {
879
- return callNative(getFuncName('canWrite'), { path: path });
859
+ return callNative(getFuncName$1('canWrite'), { path: path });
880
860
  }
881
861
  // 检测一个路径表示的文件或目录 是否可执行
882
862
  // 参数:
883
863
  // path: 指定路径
884
864
  function canExecute(path) {
885
- return callNative(getFuncName('canExecute'), { path: path });
865
+ return callNative(getFuncName$1('canExecute'), { path: path });
886
866
  }
887
867
  // 检测一个路径表示的文件或目录 的最后修改的时间,返回时间戳(1970年开始的秒数)
888
868
  // 参数:
889
869
  // path: 指定路径
890
870
  function lastModified(path) {
891
- return callNative(getFuncName('lastModified'), { path: path });
871
+ return callNative(getFuncName$1('lastModified'), { path: path });
892
872
  }
893
873
  // 删除文件
894
874
  // 参数:
895
875
  // path: 指定路径
896
876
  function deleteIt(path) {
897
- return callNative(getFuncName('delete'), { path: path });
877
+ return callNative(getFuncName$1('delete'), { path: path });
898
878
  }
899
879
  // 新建目录
900
880
  // 参数:
901
881
  // path: 指定路径
902
882
  function mkdir(path) {
903
- return callNative(getFuncName('mkdir'), { path: path });
883
+ return callNative(getFuncName$1('mkdir'), { path: path });
904
884
  }
905
885
  // 新建目录 (如果父目录补存在则一并新建所有尚未存在的父目录)
906
886
  // 参数:
907
887
  // path: 指定路径
908
888
  function mkdirs(path) {
909
- return callNative(getFuncName('mkdirs'), { path: path });
889
+ return callNative(getFuncName$1('mkdirs'), { path: path });
910
890
  }
911
891
  // 改名
912
892
  // 参数:
913
893
  // from: 指定源路径
914
894
  // to: 指定目标路径
915
895
  function rename(from, to) {
916
- return callNative(getFuncName('rename'), { from: from, to: to });
896
+ return callNative(getFuncName$1('rename'), { from: from, to: to });
917
897
  }
918
898
  // 将相对路径的转换为全路径
919
899
  // 参数:
920
900
  // path: 指定路径
921
901
  function getAbsolutePath(path) {
922
- return callNative(getFuncName('getAbsolutePath'), { path: path });
902
+ return callNative(getFuncName$1('getAbsolutePath'), { path: path });
923
903
  }
924
904
  // 指定路径创建新文件
925
905
  // 参数:
926
906
  // path: 指定路径
927
907
  function createNewFile(path) {
928
- return callNative(getFuncName('createNewFile'), { path: path });
908
+ return callNative(getFuncName$1('createNewFile'), { path: path });
929
909
  }
930
910
  // 设置可读属性
931
911
  // 参数:
@@ -933,7 +913,7 @@ function createNewFile(path) {
933
913
  // value: 是否可读
934
914
  function setReadable(path, value) {
935
915
  if (value === void 0) { value = true; }
936
- return callNative(getFuncName('setReadable'), { path: path, value: value });
916
+ return callNative(getFuncName$1('setReadable'), { path: path, value: value });
937
917
  }
938
918
  // 设置可写属性
939
919
  // 参数:
@@ -941,7 +921,7 @@ function setReadable(path, value) {
941
921
  // value: 是否可写
942
922
  function setWritable(path, value) {
943
923
  if (value === void 0) { value = true; }
944
- return callNative(getFuncName('setWritable'), { path: path, value: value });
924
+ return callNative(getFuncName$1('setWritable'), { path: path, value: value });
945
925
  }
946
926
  // 设置可执行属性
947
927
  // 参数:
@@ -949,7 +929,7 @@ function setWritable(path, value) {
949
929
  // value: 是否可执行
950
930
  function setExecutable(path, value) {
951
931
  if (value === void 0) { value = true; }
952
- return callNative(getFuncName('setExecutable'), { path: path, value: value });
932
+ return callNative(getFuncName$1('setExecutable'), { path: path, value: value });
953
933
  }
954
934
  // 设置文件最后修改的时间
955
935
  // 参数:
@@ -957,19 +937,19 @@ function setExecutable(path, value) {
957
937
  // value: 时间戳
958
938
  function setLastModified(path, value) {
959
939
  if (value === void 0) { value = 0; }
960
- return callNative(getFuncName('setLastModified'), { path: path, value: value });
940
+ return callNative(getFuncName$1('setLastModified'), { path: path, value: value });
961
941
  }
962
942
  // 读取目录,返回该目录下的文件列表
963
943
  // 参数:
964
944
  // path: 指定路径
965
945
  function list(path) {
966
- return callNative(getFuncName('list'), { path: path });
946
+ return callNative(getFuncName$1('list'), { path: path });
967
947
  }
968
- var file = {
948
+ var fs = {
969
949
  readAllContent: readAllContent,
970
950
  writeAllContent: writeAllContent,
971
- getBaseDir: getBaseDir,
972
- getCacheDir: getCacheDir,
951
+ getAppBaseDir: getAppBaseDir,
952
+ getAppCacheDir: getAppCacheDir,
973
953
  makeCacheFile: makeCacheFile,
974
954
  makeNormalFile: makeNormalFile,
975
955
  exists: exists,
@@ -993,7 +973,82 @@ var file = {
993
973
  list: list
994
974
  };
995
975
 
996
- window['appNativeCall'] = function apkNativeCall(str) {
976
+ var moduleName = 'nativeView';
977
+ function getFuncName(name) {
978
+ return moduleName + '_' + name;
979
+ }
980
+ // 播放PAG动画
981
+ // repeat: 循环次数 -1 表示无限
982
+ //
983
+ function startNewPagAni(params) {
984
+ return callNative(getFuncName('startNewPagAni'), params);
985
+ }
986
+ // 停止PAG动画,并消失
987
+ function stopPagAni() {
988
+ return callNative(getFuncName('stopPagAni'), null);
989
+ }
990
+ function setPagVisibility(visible) {
991
+ if (visible === void 0) { visible = true; }
992
+ var value = true;
993
+ if (typeof visible != 'boolean') {
994
+ if (typeof visible == 'string') {
995
+ var str = visible.toLowerCase();
996
+ value = (str == 'false' || !str) ? false : true;
997
+ }
998
+ else {
999
+ value = visible ? true : false;
1000
+ }
1001
+ }
1002
+ else {
1003
+ value = visible;
1004
+ }
1005
+ return callNative(getFuncName('setPagVisibility'), { visible: value });
1006
+ }
1007
+ function setPagXY(x, y) {
1008
+ return callNative(getFuncName('setPagXY'), { x: x, y: y });
1009
+ }
1010
+ // // 播报 TTS 文本语音
1011
+ // export function sendTts(text: string, ttsId: string): Promise<any> {
1012
+ // return callNative(getFuncName('sendTts'), { text, id: ttsId });
1013
+ // }
1014
+ // // 停止播报 TTS
1015
+ // export function stopTts(): Promise<any> {
1016
+ // return callNative(getFuncName('stopTts'), null);
1017
+ // }
1018
+ // // 流式播报 TTS
1019
+ // export function sendStreamTts(
1020
+ // text: string,
1021
+ // ttsId: string,
1022
+ // isFirst: boolean,
1023
+ // isEnd: boolean
1024
+ // ): Promise<any> {
1025
+ // return callNative(getFuncName('sendStreamTts'), { text, id: ttsId, isFirst, isEnd });
1026
+ // }
1027
+ // 设置背景
1028
+ // needUpdateColor : 是否更新颜色
1029
+ // color : 颜色值,例如 0xFFFF0000表示红色,格式为 ARGB
1030
+ // needUpdateImage : 是否更新背景图
1031
+ // imageUrl: 背景图的URL
1032
+ // export function setBackground(needUpdateColor: boolean, color: number, needUpdateImage: boolean, imageUrl: string) : Promise<any> {
1033
+ // return callNative(getFuncName('setBackground'), {updateColorFlag: needUpdateColor, updateImageFlag: needUpdateImage, color: Math.floor(color), imageUrl});
1034
+ // }
1035
+ // // 清除背景
1036
+ // export function clearBackground() : Promise<any> {
1037
+ // return callNative(getFuncName('clearBackground'), null);
1038
+ // }
1039
+ var nativeView = {
1040
+ startNewPagAni: startNewPagAni,
1041
+ stopPagAni: stopPagAni,
1042
+ setPagVisibility: setPagVisibility,
1043
+ setPagXY: setPagXY,
1044
+ // sendTts,
1045
+ // stopTts,
1046
+ // sendStreamTts,
1047
+ // setBackground,
1048
+ // clearBackground,
1049
+ };
1050
+
1051
+ function apkNativeCallJs(str) {
997
1052
  var res = null;
998
1053
  //console.log('str1=' + str);
999
1054
  try {
@@ -1021,19 +1076,25 @@ window['appNativeCall'] = function apkNativeCall(str) {
1021
1076
  onCommandFromApp(res['cmd'], res['data']);
1022
1077
  }
1023
1078
  }
1024
- };
1079
+ }
1025
1080
  function isRunInAppBrowser() {
1026
1081
  return window['_liteNativeApi'] ? true : false;
1027
1082
  }
1083
+ function init() {
1084
+ window['appNativeCall'] = apkNativeCallJs;
1085
+ initSDK();
1086
+ }
1028
1087
  var index = {
1088
+ init: init,
1029
1089
  network: network,
1030
1090
  app: app,
1031
1091
  system: system,
1032
1092
  storage: storage,
1033
- androidView: androidView,
1034
1093
  audio: audio,
1035
- file: file,
1094
+ video: video,
1095
+ nativeView: nativeView,
1096
+ fs: fs,
1036
1097
  isRunInAppBrowser: isRunInAppBrowser
1037
1098
  };
1038
1099
 
1039
- export { index as default, isRunInAppBrowser, setAppCommandCallback, unsetAppCommandCallback };
1100
+ export { index as default, init, isRunInAppBrowser, setAppCommandCallback, unsetAppCommandCallback };