@ray-js/api 0.7.5 → 0.7.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/@types/BaseKit.d.ts +1359 -1347
- package/lib/BaseKit-3.0.0.d.ts +80 -80
- package/lib/all-kits.d.ts +2 -2
- package/lib/all-kits.js +3 -3
- package/package.json +5 -5
package/@types/BaseKit.d.ts
CHANGED
@@ -1543,1321 +1543,858 @@ declare namespace ty {
|
|
1543
1543
|
encoding?: string
|
1544
1544
|
}
|
1545
1545
|
|
1546
|
-
export
|
1546
|
+
export enum HTTPMethod {
|
1547
1547
|
/** HTTP 请求 OPTIONS */
|
1548
|
-
|
1548
|
+
OPTIONS = 'OPTIONS',
|
1549
1549
|
|
1550
1550
|
/** HTTP 请求 GET */
|
1551
|
-
|
1551
|
+
GET = 'GET',
|
1552
1552
|
|
1553
1553
|
/** HTTP 请求 HEAD */
|
1554
|
-
|
1554
|
+
HEAD = 'HEAD',
|
1555
1555
|
|
1556
1556
|
/** HTTP 请求 POST */
|
1557
|
-
|
1557
|
+
POST = 'POST',
|
1558
1558
|
|
1559
1559
|
/** HTTP 请求 PUT */
|
1560
|
-
|
1560
|
+
PUT = 'PUT',
|
1561
1561
|
|
1562
1562
|
/** HTTP 请求 DELETE */
|
1563
|
-
|
1563
|
+
DELETE = 'DELETE',
|
1564
1564
|
|
1565
1565
|
/** HTTP 请求 TRACE */
|
1566
|
-
|
1566
|
+
TRACE = 'TRACE',
|
1567
1567
|
|
1568
1568
|
/** HTTP 请求 TRACE */
|
1569
|
-
|
1569
|
+
CONNECT = 'CONNECT',
|
1570
|
+
}
|
1570
1571
|
|
1571
|
-
export
|
1572
|
+
export enum AccelerometerInterval {
|
1572
1573
|
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
1573
|
-
|
1574
|
+
game = 'game',
|
1574
1575
|
|
1575
1576
|
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
1576
|
-
|
1577
|
+
ui = 'ui',
|
1577
1578
|
|
1578
1579
|
/** 普通的回调频率,在 200ms/次 左右 */
|
1579
|
-
|
1580
|
+
normal = 'normal',
|
1581
|
+
}
|
1580
1582
|
|
1581
|
-
export
|
1583
|
+
export enum DeviceMotionInterval {
|
1582
1584
|
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
1583
|
-
|
1585
|
+
game = 'game',
|
1584
1586
|
|
1585
1587
|
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
1586
|
-
|
1588
|
+
ui = 'ui',
|
1587
1589
|
|
1588
1590
|
/** 普通的回调频率,在 200ms/次 左右 */
|
1589
|
-
|
1590
|
-
}
|
1591
|
+
normal = 'normal',
|
1592
|
+
}
|
1591
1593
|
|
1592
|
-
export
|
1593
|
-
|
1594
|
-
|
1594
|
+
export enum GyroscopeInterval {
|
1595
|
+
/** 适用于更新游戏的回调频率,在 20ms/次 左右 */
|
1596
|
+
game = 'game',
|
1595
1597
|
|
1596
|
-
|
1597
|
-
|
1598
|
+
/** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
|
1599
|
+
ui = 'ui',
|
1598
1600
|
|
1599
|
-
|
1600
|
-
|
1601
|
+
/** 普通的回调频率,在 200ms/次 左右 */
|
1602
|
+
normal = 'normal',
|
1603
|
+
}
|
1601
1604
|
|
1602
|
-
export type TempFileCB = {
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
}
|
1605
|
+
export type TempFileCB = {
|
1606
|
+
/** 本地临时文件路径 (本地路径) */
|
1607
|
+
path: string
|
1608
|
+
/** 本地临时文件大小,单位 B */
|
1609
|
+
size?: number
|
1610
|
+
}
|
1608
1611
|
|
1609
|
-
export type TempMediaFileCB = {
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
}
|
1612
|
+
export type TempMediaFileCB = {
|
1613
|
+
/** 本地临时文件路径 (本地路径) */
|
1614
|
+
tempFilePath: string
|
1615
|
+
/** 本地临时文件大小,单位 B */
|
1616
|
+
size: number
|
1617
|
+
/** 视频的时间长度 */
|
1618
|
+
duration: number
|
1619
|
+
/** 视频的高度 */
|
1620
|
+
height: number
|
1621
|
+
/** 视频的宽度 */
|
1622
|
+
width: number
|
1623
|
+
/** 视频缩略图临时文件路径 */
|
1624
|
+
thumbTempFilePath: string
|
1625
|
+
/**
|
1626
|
+
* 文件类型
|
1627
|
+
* 'image' 图片
|
1628
|
+
* 'video' 视频
|
1629
|
+
*/
|
1630
|
+
fileType: string
|
1631
|
+
}
|
1629
1632
|
|
1630
|
-
export type SafeArea = {
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
}
|
1633
|
+
export type SafeArea = {
|
1634
|
+
left: number
|
1635
|
+
right: number
|
1636
|
+
top: number
|
1637
|
+
bottom: number
|
1638
|
+
width: number
|
1639
|
+
height: number
|
1640
|
+
}
|
1638
1641
|
|
1639
|
-
export
|
1642
|
+
export enum Themes {
|
1643
|
+
dark = 'dark',
|
1640
1644
|
|
1641
|
-
|
1645
|
+
light = 'light',
|
1646
|
+
}
|
1642
1647
|
|
1643
|
-
export
|
1644
|
-
|
1645
|
-
key: string
|
1646
|
-
/** key对应的内容 */
|
1647
|
-
data: string
|
1648
|
-
}
|
1648
|
+
export enum Orientation {
|
1649
|
+
portrait = 'portrait',
|
1649
1650
|
|
1650
|
-
|
1651
|
-
|
1652
|
-
key: string
|
1653
|
-
}
|
1651
|
+
landscape = 'landscape',
|
1652
|
+
}
|
1654
1653
|
|
1655
|
-
export type
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1654
|
+
export type StorageDataBean = {
|
1655
|
+
/** 本地缓存中指定的 key */
|
1656
|
+
key: string
|
1657
|
+
/** key对应的内容 */
|
1658
|
+
data: string
|
1659
|
+
}
|
1659
1660
|
|
1660
|
-
export type
|
1661
|
-
|
1662
|
-
|
1663
|
-
}
|
1661
|
+
export type StorageKeyBean = {
|
1662
|
+
/** 本地缓存中指定的 key */
|
1663
|
+
key: string
|
1664
|
+
}
|
1664
1665
|
|
1665
|
-
export type
|
1666
|
-
|
1667
|
-
|
1668
|
-
}
|
1666
|
+
export type CurrentVolumeResponse = {
|
1667
|
+
/** 音量,阈值【0 - 1】 */
|
1668
|
+
value: number
|
1669
|
+
}
|
1669
1670
|
|
1670
|
-
export type
|
1671
|
-
|
1672
|
-
|
1673
|
-
}
|
1671
|
+
export type WifiListResponse = {
|
1672
|
+
/** Wi-Fi列表 */
|
1673
|
+
wifiList: WifiInfo[]
|
1674
|
+
}
|
1674
1675
|
|
1675
|
-
export type
|
1676
|
-
|
1677
|
-
|
1678
|
-
}
|
1676
|
+
export type AudioRecordBufferBean = {
|
1677
|
+
/** 数据流 */
|
1678
|
+
buffer: number[]
|
1679
|
+
}
|
1679
1680
|
|
1680
|
-
export type
|
1681
|
-
|
1682
|
-
|
1683
|
-
}
|
1681
|
+
export type InnerAudioContext = {
|
1682
|
+
/** InnerAudioContext 对象 ContextId */
|
1683
|
+
contextId: string
|
1684
|
+
}
|
1684
1685
|
|
1685
|
-
export type
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
*/
|
1690
|
-
contextId: string
|
1691
|
-
/** src 音频资源的地址 */
|
1692
|
-
src: string
|
1693
|
-
/** startTime 开始播放的位置 */
|
1694
|
-
startTime?: number
|
1695
|
-
/** autoplay 是否自动开始播放 */
|
1696
|
-
autoplay?: boolean
|
1697
|
-
/** 是否循环播放,默认为 false */
|
1698
|
-
loop?: boolean
|
1699
|
-
/** 音量。范围 0~1。默认为 1 */
|
1700
|
-
volume?: number
|
1701
|
-
/** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
|
1702
|
-
playbackRate?: number
|
1703
|
-
}
|
1686
|
+
export type AudioFileParams = {
|
1687
|
+
/** 音频文件路径 */
|
1688
|
+
path: string
|
1689
|
+
}
|
1704
1690
|
|
1705
|
-
export type
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
position?: number
|
1710
|
-
}
|
1691
|
+
export type AudioFileResponse = {
|
1692
|
+
/** 音频时长 */
|
1693
|
+
duration: number
|
1694
|
+
}
|
1711
1695
|
|
1712
|
-
export type
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1696
|
+
export type InnerAudioBean = {
|
1697
|
+
/**
|
1698
|
+
* InnerAudioContext 对象 contextId
|
1699
|
+
* 需要传递createInnerAudioContext方法创建的InnerAudioContext对象Id才能找到播放实例
|
1700
|
+
*/
|
1701
|
+
contextId: string
|
1702
|
+
/** src 音频资源的地址 */
|
1703
|
+
src: string
|
1704
|
+
/** startTime 开始播放的位置 */
|
1705
|
+
startTime?: number
|
1706
|
+
/** autoplay 是否自动开始播放 */
|
1707
|
+
autoplay?: boolean
|
1708
|
+
/** 是否循环播放,默认为 false */
|
1709
|
+
loop?: boolean
|
1710
|
+
/** 音量。范围 0~1。默认为 1 */
|
1711
|
+
volume?: number
|
1712
|
+
/** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
|
1713
|
+
playbackRate?: number
|
1714
|
+
}
|
1726
1715
|
|
1727
|
-
export type
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
position?: string
|
1734
|
-
/** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
|
1735
|
-
extraData?: Record<string, any>
|
1736
|
-
/** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版 */
|
1737
|
-
envVersion?: string
|
1738
|
-
/** 小程序链接,当传递该参数后,可以不传 appId 和 path */
|
1739
|
-
shortLink?: string
|
1740
|
-
}
|
1716
|
+
export type InnerAudioSeekBean = {
|
1717
|
+
/** InnerAudioContext 对象 ContextId */
|
1718
|
+
contextId: string
|
1719
|
+
/** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
|
1720
|
+
position?: number
|
1721
|
+
}
|
1741
1722
|
|
1742
|
-
export type
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1723
|
+
export type AuthorizeBean = {
|
1724
|
+
/**
|
1725
|
+
* scope 权限名称
|
1726
|
+
* 举例子:
|
1727
|
+
* scope.bluetooth 蓝牙权限
|
1728
|
+
* scope.writePhotosAlbum 写入相册权限
|
1729
|
+
* scope.userLocationBackground 后台定位权限
|
1730
|
+
* scope.record 麦克风权限
|
1731
|
+
* scope.camera 摄像头权限
|
1732
|
+
* scope.userLocation 低精度定位权限
|
1733
|
+
* scope.userPreciseLocation 高精度定位权限
|
1734
|
+
*/
|
1735
|
+
scope: string
|
1736
|
+
}
|
1746
1737
|
|
1747
|
-
export type
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1738
|
+
export type ToMiniProgramBean = {
|
1739
|
+
/** 要打开的小程序appId */
|
1740
|
+
appId?: string
|
1741
|
+
/** 打开的页面路径,如果为空则打开首页,path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数 */
|
1742
|
+
path?: string
|
1743
|
+
/** 打开小程序的转场方式,分为right|bottom,指代水平和竖直方向 */
|
1744
|
+
position?: string
|
1745
|
+
/** 传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据 */
|
1746
|
+
extraData?: Record<string, any>
|
1747
|
+
/** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版 */
|
1748
|
+
envVersion?: string
|
1749
|
+
/** 小程序链接,当传递该参数后,可以不传 appId 和 path */
|
1750
|
+
shortLink?: string
|
1751
|
+
}
|
1759
1752
|
|
1760
|
-
export type
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
filePath: string
|
1765
|
-
/** 开发者服务器返回的 HTTP 状态码 */
|
1766
|
-
statusCode: number
|
1767
|
-
/** 网络请求过程中一些调试信息 */
|
1768
|
-
profile: Profile
|
1769
|
-
}
|
1753
|
+
export type DeviceMotionBean = {
|
1754
|
+
/** 监听加速度数据回调函数的执行频率 */
|
1755
|
+
interval?: DeviceMotionInterval
|
1756
|
+
}
|
1770
1757
|
|
1771
|
-
export type
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1758
|
+
export type DownLoadBean = {
|
1759
|
+
/** 网络请求id */
|
1760
|
+
requestId: string
|
1761
|
+
/** 下载资源的 url */
|
1762
|
+
url: string
|
1763
|
+
/** HTTP 请求的 Header,Header 中不能设置 Referer */
|
1764
|
+
header?: Record<string, string>
|
1765
|
+
/** 超时时间,单位为毫秒 */
|
1766
|
+
timeout?: number
|
1767
|
+
/** 指定文件下载后存储的路径 (本地路径) */
|
1768
|
+
filePath?: string
|
1769
|
+
}
|
1775
1770
|
|
1776
|
-
export type
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1771
|
+
export type DownLoadResult = {
|
1772
|
+
/** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
|
1773
|
+
tempFilePath: string
|
1774
|
+
/** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
|
1775
|
+
filePath: string
|
1776
|
+
/** 开发者服务器返回的 HTTP 状态码 */
|
1777
|
+
statusCode: number
|
1778
|
+
/** 网络请求过程中一些调试信息 */
|
1779
|
+
profile: Profile
|
1780
|
+
}
|
1780
1781
|
|
1781
|
-
export type
|
1782
|
-
|
1783
|
-
|
1784
|
-
}
|
1782
|
+
export type RequestBean = {
|
1783
|
+
/** 网络请求id */
|
1784
|
+
requestId: string
|
1785
|
+
}
|
1785
1786
|
|
1786
|
-
export type
|
1787
|
-
|
1788
|
-
|
1789
|
-
}
|
1787
|
+
export type AccessFileParams = {
|
1788
|
+
/** 要判断是否存在的文件/目录路径 (本地路径) */
|
1789
|
+
path: string
|
1790
|
+
}
|
1790
1791
|
|
1791
|
-
export type
|
1792
|
-
|
1793
|
-
|
1794
|
-
}
|
1792
|
+
export type ReadFileBean = {
|
1793
|
+
/** 文件内容 */
|
1794
|
+
data: string
|
1795
|
+
}
|
1795
1796
|
|
1796
|
-
export type
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
filePath: string
|
1801
|
-
}
|
1797
|
+
export type SaveFileSyncCallback = {
|
1798
|
+
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
1799
|
+
savedFilePath: string
|
1800
|
+
}
|
1802
1801
|
|
1803
|
-
export type
|
1804
|
-
|
1805
|
-
|
1806
|
-
}
|
1802
|
+
export type FileStatsResponse = {
|
1803
|
+
/** 文件列表 */
|
1804
|
+
fileStatsList: FileStats[]
|
1805
|
+
}
|
1807
1806
|
|
1808
|
-
export type
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
sourceType?: string[]
|
1815
|
-
}
|
1807
|
+
export type RemoveFileParams = {
|
1808
|
+
/** taskId */
|
1809
|
+
fileId: string
|
1810
|
+
/** 需要删除的文件路径 (本地路径) */
|
1811
|
+
filePath: string
|
1812
|
+
}
|
1816
1813
|
|
1817
|
-
export type
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
tempFiles?: TempFileCB[]
|
1822
|
-
}
|
1814
|
+
export type GyroscopeBean = {
|
1815
|
+
/** 监听陀螺仪数据回调函数的执行频率 */
|
1816
|
+
interval?: GyroscopeInterval
|
1817
|
+
}
|
1823
1818
|
|
1824
|
-
export type
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
mediaType?: string
|
1833
|
-
/**
|
1834
|
-
* 图片和视频选择的来源, 默认['album', 'camera']
|
1835
|
-
* 'album' 从相册选择
|
1836
|
-
* 'camera' 使用相机拍摄
|
1837
|
-
*/
|
1838
|
-
sourceType?: string[]
|
1839
|
-
/**
|
1840
|
-
* 拍摄视频最长拍摄时间,单位秒。默认10s
|
1841
|
-
* 时间范围为 3s 至 60s 之间。不限制相册。
|
1842
|
-
*/
|
1843
|
-
maxDuration?: number
|
1844
|
-
}
|
1819
|
+
export type ChooseImageBean = {
|
1820
|
+
/** 最多可以选择的图片张数 */
|
1821
|
+
count?: number
|
1822
|
+
/** sizeType ['original', 'compressed'] */
|
1823
|
+
sizeType?: string[]
|
1824
|
+
/** 选择图片的来源 ['album', 'camera'] */
|
1825
|
+
sourceType?: string[]
|
1826
|
+
}
|
1845
1827
|
|
1846
|
-
export type
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
type: string
|
1853
|
-
/** 本地临时文件列表 */
|
1854
|
-
tempFiles?: TempMediaFileCB[]
|
1855
|
-
}
|
1828
|
+
export type ChooseImageCB = {
|
1829
|
+
/** 图片的本地临时文件路径列表 (本地路径) */
|
1830
|
+
tempFilePaths: string[]
|
1831
|
+
/** sizeType ['original', 'compressed'] */
|
1832
|
+
tempFiles?: TempFileCB[]
|
1833
|
+
}
|
1856
1834
|
|
1857
|
-
export type
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1835
|
+
export type ChooseMediaBean = {
|
1836
|
+
/** 最多可以选择的文件数 */
|
1837
|
+
count?: number
|
1838
|
+
/**
|
1839
|
+
* 选择类型, 默认图片
|
1840
|
+
* 'image' 只能拍摄图片或从相册选择图片
|
1841
|
+
* 'video' 只能拍摄视频或从相册选择视频
|
1842
|
+
*/
|
1843
|
+
mediaType?: string
|
1844
|
+
/**
|
1845
|
+
* 图片和视频选择的来源, 默认['album', 'camera']
|
1846
|
+
* 'album' 从相册选择
|
1847
|
+
* 'camera' 使用相机拍摄
|
1848
|
+
*/
|
1849
|
+
sourceType?: string[]
|
1850
|
+
/**
|
1851
|
+
* 拍摄视频最长拍摄时间,单位秒。默认10s
|
1852
|
+
* 时间范围为 3s 至 60s 之间。不限制相册。
|
1853
|
+
*/
|
1854
|
+
maxDuration?: number
|
1855
|
+
}
|
1861
1856
|
|
1862
|
-
export type
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1857
|
+
export type ChooseMediaCB = {
|
1858
|
+
/**
|
1859
|
+
* 文件类型
|
1860
|
+
* 'image' 图片
|
1861
|
+
* 'video' 视频
|
1862
|
+
*/
|
1863
|
+
type: string
|
1864
|
+
/** 本地临时文件列表 */
|
1865
|
+
tempFiles?: TempMediaFileCB[]
|
1866
|
+
}
|
1866
1867
|
|
1867
|
-
export type
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
current: number
|
1872
|
-
}
|
1868
|
+
export type ChooseCropImageBean = {
|
1869
|
+
/** 选择图片的来源 ['album', 'camera'],默认都支持 */
|
1870
|
+
sourceType?: string[]
|
1871
|
+
}
|
1873
1872
|
|
1874
|
-
export type
|
1875
|
-
|
1876
|
-
|
1877
|
-
}
|
1873
|
+
export type ChooseCropImageCB = {
|
1874
|
+
/** 文件路径 */
|
1875
|
+
path: string
|
1876
|
+
}
|
1878
1877
|
|
1879
|
-
export type
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
* 拍照时设备方向
|
1886
|
-
* 合法值 说明
|
1887
|
-
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
1888
|
-
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
1889
|
-
* down 旋转180度,对应 Exif 中的 3
|
1890
|
-
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
1891
|
-
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
1892
|
-
* right 顺时针旋转90度,对应 Exif 中的 6
|
1893
|
-
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
1894
|
-
* left 逆时针旋转90度,对应 Exif 中的 8
|
1895
|
-
*/
|
1896
|
-
orientation: string
|
1897
|
-
/**
|
1898
|
-
* 图片格式。
|
1899
|
-
* 合法值 说明
|
1900
|
-
* unknown 未知格式
|
1901
|
-
* jpeg jpeg压缩格式
|
1902
|
-
* png png压缩格式
|
1903
|
-
* gif gif压缩格式
|
1904
|
-
* tiff tiff压缩格式
|
1905
|
-
*/
|
1906
|
-
type: string
|
1907
|
-
}
|
1878
|
+
export type PreviewImageBean = {
|
1879
|
+
/** 需要预览的图片链接列表 */
|
1880
|
+
urls: string[]
|
1881
|
+
/** 当前显示图片的链接 */
|
1882
|
+
current: number
|
1883
|
+
}
|
1908
1884
|
|
1909
|
-
export type
|
1910
|
-
|
1911
|
-
|
1912
|
-
}
|
1885
|
+
export type GetImageInfoParams = {
|
1886
|
+
/** 图片的路径,支持网络路径、本地路径 */
|
1887
|
+
src: string
|
1888
|
+
}
|
1913
1889
|
|
1914
|
-
export type
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
}
|
1890
|
+
export type ImageInfoCB = {
|
1891
|
+
/** 图片原始宽度,单位px。不考虑旋转。 */
|
1892
|
+
width: number
|
1893
|
+
/** 图片原始高度,单位px。不考虑旋转。 */
|
1894
|
+
height: number
|
1895
|
+
/**
|
1896
|
+
* 拍照时设备方向
|
1897
|
+
* 合法值 说明
|
1898
|
+
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
1899
|
+
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
1900
|
+
* down 旋转180度,对应 Exif 中的 3
|
1901
|
+
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
1902
|
+
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
1903
|
+
* right 顺时针旋转90度,对应 Exif 中的 6
|
1904
|
+
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
1905
|
+
* left 逆时针旋转90度,对应 Exif 中的 8
|
1906
|
+
*/
|
1907
|
+
orientation: string
|
1908
|
+
/**
|
1909
|
+
* 图片格式。
|
1910
|
+
* 合法值 说明
|
1911
|
+
* unknown 未知格式
|
1912
|
+
* jpeg jpeg压缩格式
|
1913
|
+
* png png压缩格式
|
1914
|
+
* gif gif压缩格式
|
1915
|
+
* tiff tiff压缩格式
|
1916
|
+
*/
|
1917
|
+
type: string
|
1918
|
+
}
|
1943
1919
|
|
1944
|
-
export type
|
1945
|
-
|
1946
|
-
|
1947
|
-
}
|
1920
|
+
export type GetVideoInfoParams = {
|
1921
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
|
1922
|
+
src: string
|
1923
|
+
}
|
1948
1924
|
|
1949
|
-
export type
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1925
|
+
export type VideoInfoCB = {
|
1926
|
+
/** 图片原始宽度,单位px。不考虑旋转。 */
|
1927
|
+
width: number
|
1928
|
+
/** 图片原始高度,单位px。不考虑旋转。 */
|
1929
|
+
height: number
|
1930
|
+
/**
|
1931
|
+
* 画面方向
|
1932
|
+
* 合法值 说明
|
1933
|
+
* up 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。
|
1934
|
+
* up-mirrored 同 up,但镜像翻转,对应 Exif 中的 2
|
1935
|
+
* down 旋转180度,对应 Exif 中的 3
|
1936
|
+
* down-mirrored 同 down,但镜像翻转,对应 Exif 中的 4
|
1937
|
+
* left-mirrored 同 left,但镜像翻转,对应 Exif 中的 5
|
1938
|
+
* right 顺时针旋转90度,对应 Exif 中的 6
|
1939
|
+
* right-mirrored 同 right,但镜像翻转,对应 Exif 中的 7
|
1940
|
+
* left 逆时针旋转90度,对应 Exif 中的 8
|
1941
|
+
*/
|
1942
|
+
orientation: string
|
1943
|
+
/** 视频格式 */
|
1944
|
+
type: string
|
1945
|
+
/** 视频时长 */
|
1946
|
+
duration: number
|
1947
|
+
/** 视频大小,单位 kB */
|
1948
|
+
size: number
|
1949
|
+
/** 视频帧率 */
|
1950
|
+
fps: number
|
1951
|
+
/** 视频码率,单位 kbps */
|
1952
|
+
bitrate: number
|
1953
|
+
}
|
1961
1954
|
|
1962
|
-
export type
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
content?: string
|
1967
|
-
/** 是否显示取消按钮 */
|
1968
|
-
showCancel?: boolean
|
1969
|
-
/** 取消按钮的文字,最多 4 个字符 */
|
1970
|
-
cancelText?: string
|
1971
|
-
/** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
1972
|
-
cancelColor?: string
|
1973
|
-
/** 确认按钮的文字,最多 4 个字符 */
|
1974
|
-
confirmText?: string
|
1975
|
-
/** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
1976
|
-
confirmColor?: string
|
1977
|
-
}
|
1955
|
+
export type SaveVideoParams = {
|
1956
|
+
/** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
|
1957
|
+
filePath: string
|
1958
|
+
}
|
1978
1959
|
|
1979
|
-
export type
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1960
|
+
export type ToastBean = {
|
1961
|
+
/** 提示的内容 */
|
1962
|
+
title: string
|
1963
|
+
/** 图标 'success' / 'error' / 'loading' / 'none' */
|
1964
|
+
icon?: string
|
1965
|
+
/** 自定义图标的本地路径,image 的优先级高于 icon */
|
1966
|
+
image?: string
|
1967
|
+
/** 提示的延迟时间 */
|
1968
|
+
duration?: number
|
1969
|
+
/** 是否显示透明蒙层,防止触摸穿透 */
|
1970
|
+
mask?: boolean
|
1971
|
+
}
|
1985
1972
|
|
1986
|
-
export type
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1973
|
+
export type ModalBean = {
|
1974
|
+
/** 提示的标题 */
|
1975
|
+
title: string
|
1976
|
+
/** 提示的内容 */
|
1977
|
+
content?: string
|
1978
|
+
/** 是否显示取消按钮 */
|
1979
|
+
showCancel?: boolean
|
1980
|
+
/** 取消按钮的文字,最多 4 个字符 */
|
1981
|
+
cancelText?: string
|
1982
|
+
/** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
1983
|
+
cancelColor?: string
|
1984
|
+
/** 确认按钮的文字,最多 4 个字符 */
|
1985
|
+
confirmText?: string
|
1986
|
+
/** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
|
1987
|
+
confirmColor?: string
|
1988
|
+
}
|
1992
1989
|
|
1993
|
-
export type
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
itemColor?: string
|
2000
|
-
}
|
1990
|
+
export type ModalCallback = {
|
1991
|
+
/** 为 true 时,表示用户点击了确定按钮 */
|
1992
|
+
confirm: boolean
|
1993
|
+
/** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
|
1994
|
+
cancel: boolean
|
1995
|
+
}
|
2001
1996
|
|
2002
|
-
export type
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
1997
|
+
export type LoadingBean = {
|
1998
|
+
/** 提示的内容 */
|
1999
|
+
title: string
|
2000
|
+
/** 是否显示透明蒙层,防止触摸穿透 */
|
2001
|
+
mask?: boolean
|
2002
|
+
}
|
2006
2003
|
|
2007
|
-
export type
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
header?: Record<string, string>
|
2016
|
-
/** 超时时间,单位为毫秒 */
|
2017
|
-
timeout?: number
|
2018
|
-
/** HTTP 请求方法 */
|
2019
|
-
method?: HTTPMethod
|
2020
|
-
/** 返回的数据格式 */
|
2021
|
-
dataType?: any
|
2022
|
-
/** 返回的数据类型 */
|
2023
|
-
responseType?: string
|
2024
|
-
/** enableHttp2 */
|
2025
|
-
enableHttp2?: boolean
|
2026
|
-
/** enableQuic */
|
2027
|
-
enableQuic?: boolean
|
2028
|
-
/** enableCache */
|
2029
|
-
enableCache?: boolean
|
2030
|
-
}
|
2004
|
+
export type ActionSheet = {
|
2005
|
+
/** 警示文案 */
|
2006
|
+
alertText?: string
|
2007
|
+
/** 按钮的文字数组,数组长度最大为 6 */
|
2008
|
+
itemList: string[]
|
2009
|
+
/** 按钮的文字颜色 */
|
2010
|
+
itemColor?: string
|
2011
|
+
}
|
2031
2012
|
|
2032
|
-
export type
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
statusCode: number
|
2037
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
2038
|
-
header: Record<string, string>
|
2039
|
-
/** 开发者服务器返回的 cookies,格式为字符串数组 */
|
2040
|
-
cookies: string[]
|
2041
|
-
/** 网络请求过程中一些调试信息 */
|
2042
|
-
profile: Profile
|
2043
|
-
/** 网络请求id,用户取消、监听等操作 */
|
2044
|
-
taskId: string
|
2045
|
-
}
|
2013
|
+
export type ActionSheetCallback = {
|
2014
|
+
/** 用户点击的按钮序号,从上到下的顺序,从0开始 */
|
2015
|
+
tapIndex: number
|
2016
|
+
}
|
2046
2017
|
|
2047
|
-
export type
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2018
|
+
export type HTTPRequest = {
|
2019
|
+
/** 开发者服务器接口地址 */
|
2020
|
+
url: string
|
2021
|
+
/** 网络请求 id */
|
2022
|
+
taskId: string
|
2023
|
+
/** 请求的参数 */
|
2024
|
+
data?: string
|
2025
|
+
/** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
|
2026
|
+
header?: Record<string, string>
|
2027
|
+
/** 超时时间,单位为毫秒 */
|
2028
|
+
timeout?: number
|
2029
|
+
/** HTTP 请求方法 */
|
2030
|
+
method?: HTTPMethod
|
2031
|
+
/** 返回的数据格式 */
|
2032
|
+
dataType?: any
|
2033
|
+
/** 返回的数据类型 */
|
2034
|
+
responseType?: string
|
2035
|
+
/** enableHttp2 */
|
2036
|
+
enableHttp2?: boolean
|
2037
|
+
/** enableQuic */
|
2038
|
+
enableQuic?: boolean
|
2039
|
+
/** enableCache */
|
2040
|
+
enableCache?: boolean
|
2041
|
+
}
|
2051
2042
|
|
2052
|
-
export type
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2043
|
+
export type SuccessResult = {
|
2044
|
+
/** 开发者服务器返回的数据 */
|
2045
|
+
data: string
|
2046
|
+
/** 开发者服务器返回的 HTTP 状态码 */
|
2047
|
+
statusCode: number
|
2048
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
2049
|
+
header: Record<string, string>
|
2050
|
+
/** 开发者服务器返回的 cookies,格式为字符串数组 */
|
2051
|
+
cookies: string[]
|
2052
|
+
/** 网络请求过程中一些调试信息 */
|
2053
|
+
profile: Profile
|
2054
|
+
/** 网络请求id,用户取消、监听等操作 */
|
2055
|
+
taskId: string
|
2056
|
+
}
|
2056
2057
|
|
2057
|
-
export type
|
2058
|
-
|
2059
|
-
|
2060
|
-
}
|
2058
|
+
export type RequestContext = {
|
2059
|
+
/** 网络请求id */
|
2060
|
+
taskId: string
|
2061
|
+
}
|
2061
2062
|
|
2062
|
-
export type
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
BSSID: string
|
2067
|
-
/** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
|
2068
|
-
signalStrength: number
|
2069
|
-
/**
|
2070
|
-
* Wi-Fi是否安全
|
2071
|
-
* Android:Android系统12开始支持。
|
2072
|
-
*/
|
2073
|
-
secure: boolean
|
2074
|
-
/** Wi-Fi 频段单位 MHz */
|
2075
|
-
frequency: number
|
2076
|
-
}
|
2063
|
+
export type PhoneCallBean = {
|
2064
|
+
/** 需要拨打的电话号码 */
|
2065
|
+
phoneNumber: string
|
2066
|
+
}
|
2077
2067
|
|
2078
|
-
export type
|
2079
|
-
|
2080
|
-
|
2081
|
-
}
|
2068
|
+
export type ClipboradDataBean = {
|
2069
|
+
/** 剪贴板的内容 */
|
2070
|
+
data: string
|
2071
|
+
}
|
2082
2072
|
|
2083
|
-
export type
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
|
2073
|
+
export type WifiInfo = {
|
2074
|
+
/** wifi的SSID */
|
2075
|
+
SSID: string
|
2076
|
+
/** wifi的BSSID */
|
2077
|
+
BSSID: string
|
2078
|
+
/** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
|
2079
|
+
signalStrength: number
|
2080
|
+
/**
|
2081
|
+
* Wi-Fi是否安全
|
2082
|
+
* Android:Android系统12开始支持。
|
2083
|
+
*/
|
2084
|
+
secure: boolean
|
2085
|
+
/** Wi-Fi 频段单位 MHz */
|
2086
|
+
frequency: number
|
2087
|
+
}
|
2096
2088
|
|
2097
|
-
export type
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
brand: string
|
2102
|
-
/** 设备型号。新机型刚推出一段时间会显示unknown。 */
|
2103
|
-
model: string
|
2104
|
-
/** 操作系统及版本 */
|
2105
|
-
system: string
|
2106
|
-
/** 客户端平台 */
|
2107
|
-
platform: string
|
2108
|
-
}
|
2089
|
+
export type UpdateVolumeParams = {
|
2090
|
+
/** 音量,阈值【0 - 1】 */
|
2091
|
+
value: number
|
2092
|
+
}
|
2109
2093
|
|
2110
|
-
export type
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
language: string
|
2124
|
-
safeArea: SafeArea
|
2125
|
-
albumAuthorized: boolean
|
2126
|
-
cameraAuthorized: boolean
|
2127
|
-
locationAuthorized: boolean
|
2128
|
-
microphoneAuthorized: boolean
|
2129
|
-
notificationAuthorized: boolean
|
2130
|
-
notificationAlertAuthorized: boolean
|
2131
|
-
notificationBadgeAuthorized: boolean
|
2132
|
-
notificationSoundAuthorized: boolean
|
2133
|
-
bluetoothEnabled: boolean
|
2134
|
-
locationEnabled: boolean
|
2135
|
-
wifiEnabled: boolean
|
2136
|
-
theme?: Themes
|
2137
|
-
deviceOrientation?: Orientation
|
2138
|
-
}
|
2094
|
+
export type SystemSetting = {
|
2095
|
+
/** 蓝牙的系统开关,默认false */
|
2096
|
+
bluetoothEnabled?: boolean
|
2097
|
+
/** 地理位置的系统开关,默认false */
|
2098
|
+
locationEnabled?: boolean
|
2099
|
+
/** Wi-Fi 的系统开关,默认false */
|
2100
|
+
wifiEnabled?: boolean
|
2101
|
+
/**
|
2102
|
+
* 设备方向, 默认竖屏
|
2103
|
+
* 竖屏 = "portrait", 横屏 = "landscape"
|
2104
|
+
*/
|
2105
|
+
deviceOrientation?: string
|
2106
|
+
}
|
2139
2107
|
|
2140
|
-
export type
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2108
|
+
export type DeviceInfoResponse = {
|
2109
|
+
/** 应用二进制接口类型(仅 Android 支持) */
|
2110
|
+
abi: string
|
2111
|
+
/** 设备品牌 */
|
2112
|
+
brand: string
|
2113
|
+
/** 设备型号。新机型刚推出一段时间会显示unknown。 */
|
2114
|
+
model: string
|
2115
|
+
/** 操作系统及版本 */
|
2116
|
+
system: string
|
2117
|
+
/** 客户端平台 */
|
2118
|
+
platform: string
|
2119
|
+
}
|
2149
2120
|
|
2150
|
-
export type
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2121
|
+
export type SystemInfo = {
|
2122
|
+
is24Hour: boolean
|
2123
|
+
system: string
|
2124
|
+
brand: string
|
2125
|
+
model: string
|
2126
|
+
platform: string
|
2127
|
+
timezoneId: string
|
2128
|
+
pixelRatio: number
|
2129
|
+
screenWidth: number
|
2130
|
+
screenHeight: number
|
2131
|
+
windowWidth: number
|
2132
|
+
windowHeight: number
|
2133
|
+
statusBarHeight: number
|
2134
|
+
language: string
|
2135
|
+
safeArea: SafeArea
|
2136
|
+
albumAuthorized: boolean
|
2137
|
+
cameraAuthorized: boolean
|
2138
|
+
locationAuthorized: boolean
|
2139
|
+
microphoneAuthorized: boolean
|
2140
|
+
notificationAuthorized: boolean
|
2141
|
+
notificationAlertAuthorized: boolean
|
2142
|
+
notificationBadgeAuthorized: boolean
|
2143
|
+
notificationSoundAuthorized: boolean
|
2144
|
+
bluetoothEnabled: boolean
|
2145
|
+
locationEnabled: boolean
|
2146
|
+
wifiEnabled: boolean
|
2147
|
+
theme?: Themes
|
2148
|
+
deviceOrientation?: Orientation
|
2149
|
+
}
|
2156
2150
|
|
2157
|
-
export type
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2151
|
+
export type GetConnectedWifiParams = {
|
2152
|
+
/**
|
2153
|
+
* 是否需要返回部分 Wi-Fi 信息
|
2154
|
+
* 安卓 thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID 属性的 WifiInfo 对象。
|
2155
|
+
* iOS thing.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
|
2156
|
+
* 默认值:false
|
2157
|
+
*/
|
2158
|
+
partialInfo?: boolean
|
2159
|
+
}
|
2161
2160
|
|
2162
|
-
export type
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2161
|
+
export type NetworkTypeCB = {
|
2162
|
+
/** 网络类型 */
|
2163
|
+
networkType: string
|
2164
|
+
/** 信号强弱,单位 dbm */
|
2165
|
+
signalStrength: number
|
2166
|
+
}
|
2166
2167
|
|
2167
|
-
export type
|
2168
|
-
|
2169
|
-
|
2170
|
-
}
|
2168
|
+
export type ScreenBean = {
|
2169
|
+
/** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */
|
2170
|
+
value: number
|
2171
|
+
}
|
2171
2172
|
|
2172
|
-
export type
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
sampleRate?: number
|
2177
|
-
/** 录音通道数 */
|
2178
|
-
numberOfChannels?: number
|
2179
|
-
/** 编码码率,有效值见下表格 */
|
2180
|
-
encodeBitRate?: number
|
2181
|
-
/** 音频格式 */
|
2182
|
-
format?: string
|
2183
|
-
/** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
|
2184
|
-
frameSize: number
|
2185
|
-
/** 指定录音的音频输入源 */
|
2186
|
-
audioSource?: string
|
2187
|
-
/** 录音上下文 */
|
2188
|
-
contextId: string
|
2189
|
-
}
|
2173
|
+
export type SetKeepScreenOnParam = {
|
2174
|
+
/** 是否保持屏幕常亮 */
|
2175
|
+
keepScreenOn: boolean
|
2176
|
+
}
|
2190
2177
|
|
2191
|
-
export type
|
2192
|
-
|
2193
|
-
|
2194
|
-
}
|
2178
|
+
export type TUNIVibrateBean = {
|
2179
|
+
/** 震动强度类型,有效值为:heavy、medium、light */
|
2180
|
+
type: string
|
2181
|
+
}
|
2195
2182
|
|
2196
|
-
export type
|
2197
|
-
|
2198
|
-
|
2199
|
-
|
2183
|
+
export type AudioStart = {
|
2184
|
+
/** 录音的时长,单位 ms,最大值 600000(10 分钟) */
|
2185
|
+
duration?: number
|
2186
|
+
/** 采样率 */
|
2187
|
+
sampleRate?: number
|
2188
|
+
/** 录音通道数 */
|
2189
|
+
numberOfChannels?: number
|
2190
|
+
/** 编码码率,有效值见下表格 */
|
2191
|
+
encodeBitRate?: number
|
2192
|
+
/** 音频格式 */
|
2193
|
+
format?: string
|
2194
|
+
/** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
|
2195
|
+
frameSize: number
|
2196
|
+
/** 指定录音的音频输入源 */
|
2197
|
+
audioSource?: string
|
2198
|
+
/** 录音上下文 */
|
2199
|
+
contextId: string
|
2200
|
+
}
|
2200
2201
|
|
2201
|
-
export type
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2205
|
-
period: number
|
2206
|
-
}
|
2202
|
+
export type AudioRecordResult = {
|
2203
|
+
/** 录音文件的临时路径 (本地路径) */
|
2204
|
+
tempFilePath: string
|
2205
|
+
}
|
2207
2206
|
|
2208
|
-
export type
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
scanType?: string[]
|
2213
|
-
}
|
2207
|
+
export type AudioRecordContext = {
|
2208
|
+
/** 对象id */
|
2209
|
+
contextId: string
|
2210
|
+
}
|
2214
2211
|
|
2215
|
-
export type
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
charSet: string
|
2222
|
-
/** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path (不一定会有返回值) */
|
2223
|
-
path: string
|
2224
|
-
/** 原始数据,base64编码 */
|
2225
|
-
rawData: string
|
2226
|
-
}
|
2212
|
+
export type AudioRecordingRequest = {
|
2213
|
+
/** 录音上下文 */
|
2214
|
+
contextId: string
|
2215
|
+
/** 间隔时间 ms */
|
2216
|
+
period: number
|
2217
|
+
}
|
2227
2218
|
|
2228
|
-
export type
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2219
|
+
export type ScanCodeBean = {
|
2220
|
+
/** 是否只能从相机扫码,不允许从相册选择图片 */
|
2221
|
+
onlyFromCamera?: boolean
|
2222
|
+
/** 扫码类型 */
|
2223
|
+
scanType?: string[]
|
2224
|
+
}
|
2232
2225
|
|
2233
|
-
export type
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
formData?: Record<string, string>
|
2246
|
-
/** 超时时间,单位为毫秒 */
|
2247
|
-
timeout?: number
|
2248
|
-
}
|
2226
|
+
export type ScanCodeResult = {
|
2227
|
+
/** 所扫码的内容 */
|
2228
|
+
result: string
|
2229
|
+
/** 所扫码的类型 */
|
2230
|
+
scanType: string
|
2231
|
+
/** 所扫码的字符集 */
|
2232
|
+
charSet: string
|
2233
|
+
/** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path (不一定会有返回值) */
|
2234
|
+
path: string
|
2235
|
+
/** 原始数据,base64编码 */
|
2236
|
+
rawData: string
|
2237
|
+
}
|
2249
2238
|
|
2250
|
-
export type
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
statusCode: number
|
2255
|
-
}
|
2239
|
+
export type StorageCallback = {
|
2240
|
+
/** key对应的内容 */
|
2241
|
+
data?: string
|
2242
|
+
}
|
2256
2243
|
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
}
|
2274
|
-
}) => void
|
2275
|
-
}): void
|
2244
|
+
export type UpLoadBean = {
|
2245
|
+
/** 网络请求id */
|
2246
|
+
requestId: string
|
2247
|
+
/** 开发者服务器地址 */
|
2248
|
+
url: string
|
2249
|
+
/** 要上传文件资源的路径 (本地路径) */
|
2250
|
+
filePath: string
|
2251
|
+
/** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
|
2252
|
+
name: string
|
2253
|
+
/** HTTP 请求的 Header,Header 中不能设置 Referer */
|
2254
|
+
header?: Record<string, string>
|
2255
|
+
/** HTTP 请求中其他额外的 form data */
|
2256
|
+
formData?: Record<string, string>
|
2257
|
+
/** 超时时间,单位为毫秒 */
|
2258
|
+
timeout?: number
|
2259
|
+
}
|
2276
2260
|
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
|
2283
|
-
fail?: (params: {
|
2284
|
-
errorMsg: string
|
2285
|
-
errorCode: string | number
|
2286
|
-
innerError: {
|
2287
|
-
errorCode: string | number
|
2288
|
-
errorMsg: string
|
2289
|
-
}
|
2290
|
-
}) => void
|
2291
|
-
}): void
|
2261
|
+
export type UpLoadResult = {
|
2262
|
+
/** 开发者服务器返回的数据 */
|
2263
|
+
data: string
|
2264
|
+
/** 开发者服务器返回的 HTTP 状态码 */
|
2265
|
+
statusCode: number
|
2266
|
+
}
|
2292
2267
|
|
2293
2268
|
/**
|
2294
|
-
*
|
2269
|
+
* 创建内部audio上下文InnerAudioContext对象
|
2295
2270
|
*/
|
2296
|
-
|
2297
|
-
/**
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
loop?: boolean
|
2305
|
-
/** 音量。范围 0~1。默认为 1 */
|
2306
|
-
volume?: number
|
2307
|
-
/** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
|
2308
|
-
playbackRate?: number
|
2309
|
-
complete?: () => void
|
2310
|
-
success?: (params: null) => void
|
2311
|
-
fail?: (params: {
|
2312
|
-
errorMsg: string
|
2313
|
-
errorCode: string | number
|
2314
|
-
innerError: {
|
2315
|
-
errorCode: string | number
|
2271
|
+
interface CreateInnerAudioContextTask {
|
2272
|
+
/**
|
2273
|
+
* 暂停
|
2274
|
+
*/
|
2275
|
+
pause(params: {
|
2276
|
+
complete?: () => void
|
2277
|
+
success?: (params: null) => void
|
2278
|
+
fail?: (params: {
|
2316
2279
|
errorMsg: string
|
2317
|
-
}
|
2318
|
-
}) => void
|
2319
|
-
}): void
|
2320
|
-
|
2321
|
-
/**
|
2322
|
-
* 跳转到指定位置
|
2323
|
-
*/
|
2324
|
-
seek(params: {
|
2325
|
-
/** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
|
2326
|
-
position?: number
|
2327
|
-
complete?: () => void
|
2328
|
-
success?: (params: null) => void
|
2329
|
-
fail?: (params: {
|
2330
|
-
errorMsg: string
|
2331
|
-
errorCode: string | number
|
2332
|
-
innerError: {
|
2333
2280
|
errorCode: string | number
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2281
|
+
innerError: {
|
2282
|
+
errorCode: string | number
|
2283
|
+
errorMsg: string
|
2284
|
+
}
|
2285
|
+
}) => void
|
2286
|
+
}): void
|
2338
2287
|
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
errorMsg: string
|
2347
|
-
errorCode: string | number
|
2348
|
-
innerError: {
|
2349
|
-
errorCode: string | number
|
2288
|
+
/**
|
2289
|
+
* 恢复
|
2290
|
+
*/
|
2291
|
+
resume(params: {
|
2292
|
+
complete?: () => void
|
2293
|
+
success?: (params: null) => void
|
2294
|
+
fail?: (params: {
|
2350
2295
|
errorMsg: string
|
2351
|
-
}
|
2352
|
-
}) => void
|
2353
|
-
}): void
|
2354
|
-
|
2355
|
-
/**
|
2356
|
-
* 销毁当前实例
|
2357
|
-
*/
|
2358
|
-
destroy(params: {
|
2359
|
-
complete?: () => void
|
2360
|
-
success?: (params: null) => void
|
2361
|
-
fail?: (params: {
|
2362
|
-
errorMsg: string
|
2363
|
-
errorCode: string | number
|
2364
|
-
innerError: {
|
2365
2296
|
errorCode: string | number
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
* 监听音频播放进度更新事件
|
2373
|
-
*/
|
2374
|
-
onTimeUpdate(
|
2375
|
-
listener: (params: {
|
2376
|
-
/** InnerAudioContext 对象 ContextId */
|
2377
|
-
contextId: string
|
2378
|
-
/** 播放进度 【0 - 1】 */
|
2379
|
-
time: number
|
2380
|
-
}) => void
|
2381
|
-
): void
|
2382
|
-
}
|
2383
|
-
export function createInnerAudioContext(params?: {
|
2384
|
-
complete?: () => void
|
2385
|
-
success?: (params: null) => void
|
2386
|
-
fail?: (params: {
|
2387
|
-
errorMsg: string
|
2388
|
-
errorCode: string | number
|
2389
|
-
innerError: {
|
2390
|
-
errorCode: string | number
|
2391
|
-
errorMsg: string
|
2392
|
-
}
|
2393
|
-
}) => void
|
2394
|
-
}): CreateInnerAudioContextTask
|
2395
|
-
|
2396
|
-
/**
|
2397
|
-
* 一个可以监听下载进度变化事件,以及取消下载任务的对象
|
2398
|
-
*/
|
2399
|
-
interface DownloadFileTask {
|
2400
|
-
/**
|
2401
|
-
* 中断下载任务
|
2402
|
-
*/
|
2403
|
-
abort(params: {
|
2404
|
-
complete?: () => void
|
2405
|
-
success?: (params: null) => void
|
2406
|
-
failure?: (params: {
|
2407
|
-
errorMsg: string
|
2408
|
-
errorCode: string | number
|
2409
|
-
innerError: {
|
2410
|
-
errorCode: string | number
|
2411
|
-
errorMsg: string
|
2412
|
-
}
|
2413
|
-
}) => void
|
2414
|
-
}): void
|
2415
|
-
|
2416
|
-
/**
|
2417
|
-
* 监听 HTTP Response Header 事件。会比请求完成事件更早
|
2418
|
-
*/
|
2419
|
-
onHeadersReceived(
|
2420
|
-
listener: (params: {
|
2421
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
2422
|
-
header: Record<string, string>
|
2423
|
-
/** 网络请求id */
|
2424
|
-
requestId: string
|
2425
|
-
}) => void
|
2426
|
-
): void
|
2427
|
-
|
2428
|
-
/**
|
2429
|
-
* 取消监听 HTTP Response Header 事件
|
2430
|
-
*/
|
2431
|
-
offHeadersReceived(
|
2432
|
-
listener: (params: {
|
2433
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
2434
|
-
header: Record<string, string>
|
2435
|
-
/** 网络请求id */
|
2436
|
-
requestId: string
|
2437
|
-
}) => void
|
2438
|
-
): void
|
2439
|
-
|
2440
|
-
/**
|
2441
|
-
* 监听下载进度变化事件
|
2442
|
-
*/
|
2443
|
-
onProgressUpdate(
|
2444
|
-
listener: (params: {
|
2445
|
-
/** 下载进度百分比 */
|
2446
|
-
progress: number
|
2447
|
-
/** 已经下载的数据长度,单位 Bytes */
|
2448
|
-
totalBytesSent: number
|
2449
|
-
/** 预期需要下载的数据总长度,单位 Bytes */
|
2450
|
-
totalBytesExpectedToSend: number
|
2451
|
-
/** 网络请求id */
|
2452
|
-
requestId: string
|
2453
|
-
}) => void
|
2454
|
-
): void
|
2455
|
-
|
2456
|
-
/**
|
2457
|
-
* 取消监听下载进度变化事件
|
2458
|
-
*/
|
2459
|
-
offProgressUpdate(
|
2460
|
-
listener: (params: {
|
2461
|
-
/** 下载进度百分比 */
|
2462
|
-
progress: number
|
2463
|
-
/** 已经下载的数据长度,单位 Bytes */
|
2464
|
-
totalBytesSent: number
|
2465
|
-
/** 预期需要下载的数据总长度,单位 Bytes */
|
2466
|
-
totalBytesExpectedToSend: number
|
2467
|
-
/** 网络请求id */
|
2468
|
-
requestId: string
|
2469
|
-
}) => void
|
2470
|
-
): void
|
2471
|
-
}
|
2472
|
-
export function downloadFile(params: {
|
2473
|
-
/** 下载资源的 url */
|
2474
|
-
url: string
|
2475
|
-
/** HTTP 请求的 Header,Header 中不能设置 Referer */
|
2476
|
-
header?: Record<string, string>
|
2477
|
-
/** 超时时间,单位为毫秒 */
|
2478
|
-
timeout?: number
|
2479
|
-
/** 指定文件下载后存储的路径 (本地路径) */
|
2480
|
-
filePath?: string
|
2481
|
-
complete?: () => void
|
2482
|
-
success?: (params: {
|
2483
|
-
/** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
|
2484
|
-
tempFilePath: string
|
2485
|
-
/** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
|
2486
|
-
filePath: string
|
2487
|
-
/** 开发者服务器返回的 HTTP 状态码 */
|
2488
|
-
statusCode: number
|
2489
|
-
/** 网络请求过程中一些调试信息 */
|
2490
|
-
profile: Profile
|
2491
|
-
}) => void
|
2492
|
-
failure?: (params: {
|
2493
|
-
errorMsg: string
|
2494
|
-
errorCode: string | number
|
2495
|
-
innerError: {
|
2496
|
-
errorCode: string | number
|
2497
|
-
errorMsg: string
|
2498
|
-
}
|
2499
|
-
}) => void
|
2500
|
-
}): DownloadFileTask
|
2501
|
-
|
2502
|
-
/**
|
2503
|
-
* 文件管理器
|
2504
|
-
*/
|
2505
|
-
interface GetFileSystemManagerTask {
|
2506
|
-
/**
|
2507
|
-
* 判断文件/目录是否存在
|
2508
|
-
*/
|
2509
|
-
access(params: {
|
2510
|
-
/** 要判断是否存在的文件/目录路径 (本地路径) */
|
2511
|
-
path: string
|
2512
|
-
complete?: () => void
|
2513
|
-
success?: (params: null) => void
|
2514
|
-
fail?: (params: {
|
2515
|
-
errorMsg: string
|
2516
|
-
errorCode: string | number
|
2517
|
-
innerError: {
|
2518
|
-
errorCode: string | number
|
2519
|
-
errorMsg: string
|
2520
|
-
}
|
2521
|
-
}) => void
|
2522
|
-
}): void
|
2523
|
-
|
2524
|
-
/**
|
2525
|
-
* 读取本地文件内容
|
2526
|
-
*/
|
2527
|
-
readFile(params: {
|
2528
|
-
/** 要写入的文件路径 (本地路径) */
|
2529
|
-
filePath: string
|
2530
|
-
/**
|
2531
|
-
* 指定读取文件的字符编码。
|
2532
|
-
* 支持 utf8/ascii/base64。如果不传 encoding,默认utf8
|
2533
|
-
*/
|
2534
|
-
encoding?: string
|
2535
|
-
/** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
|
2536
|
-
position?: number
|
2537
|
-
/** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
2538
|
-
length?: number
|
2539
|
-
complete?: () => void
|
2540
|
-
success?: (params: {
|
2541
|
-
/** 文件内容 */
|
2542
|
-
data: string
|
2543
|
-
}) => void
|
2544
|
-
fail?: (params: {
|
2545
|
-
errorMsg: string
|
2546
|
-
errorCode: string | number
|
2547
|
-
innerError: {
|
2548
|
-
errorCode: string | number
|
2549
|
-
errorMsg: string
|
2550
|
-
}
|
2551
|
-
}) => void
|
2552
|
-
}): void
|
2553
|
-
|
2554
|
-
/**
|
2555
|
-
* 读取本地文件内容
|
2556
|
-
*/
|
2557
|
-
readFileSync(req?: FileReadFileReqBean): {
|
2558
|
-
/** 文件内容 */
|
2559
|
-
data: string
|
2560
|
-
}
|
2561
|
-
|
2562
|
-
/**
|
2563
|
-
* 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
|
2564
|
-
*/
|
2565
|
-
saveFile(params: {
|
2566
|
-
/** 临时存储文件路径 */
|
2567
|
-
tempFilePath: string
|
2568
|
-
/** 要存储的文件路径 */
|
2569
|
-
filePath: string
|
2570
|
-
complete?: () => void
|
2571
|
-
success?: (params: {
|
2572
|
-
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
2573
|
-
savedFilePath: string
|
2574
|
-
}) => void
|
2575
|
-
fail?: (params: {
|
2576
|
-
errorMsg: string
|
2577
|
-
errorCode: string | number
|
2578
|
-
innerError: {
|
2579
|
-
errorCode: string | number
|
2580
|
-
errorMsg: string
|
2581
|
-
}
|
2582
|
-
}) => void
|
2583
|
-
}): void
|
2584
|
-
|
2585
|
-
/**
|
2586
|
-
* 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
|
2587
|
-
*/
|
2588
|
-
saveFileSync(params?: SaveFileSyncParams): {
|
2589
|
-
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
2590
|
-
savedFilePath: string
|
2591
|
-
}
|
2592
|
-
|
2593
|
-
/**
|
2594
|
-
* 获取文件Stats对象,需要文件读写权限
|
2595
|
-
*/
|
2596
|
-
stat(params: {
|
2597
|
-
/** 文件/目录路径 (本地路径) */
|
2598
|
-
path: string
|
2599
|
-
/**
|
2600
|
-
* 是否递归获取目录下的每个文件的 Stats 信息
|
2601
|
-
* 默认值:false
|
2602
|
-
*/
|
2603
|
-
recursive?: boolean
|
2604
|
-
complete?: () => void
|
2605
|
-
success?: (params: {
|
2606
|
-
/** 文件列表 */
|
2607
|
-
fileStatsList: FileStats[]
|
2608
|
-
}) => void
|
2609
|
-
fail?: (params: {
|
2610
|
-
errorMsg: string
|
2611
|
-
errorCode: string | number
|
2612
|
-
innerError: {
|
2613
|
-
errorCode: string | number
|
2614
|
-
errorMsg: string
|
2615
|
-
}
|
2616
|
-
}) => void
|
2617
|
-
}): void
|
2618
|
-
|
2619
|
-
/**
|
2620
|
-
* 获取文件Stats对象,需要文件读写权限
|
2621
|
-
*/
|
2622
|
-
statSync(params?: FileStatsParams): {
|
2623
|
-
/** 文件列表 */
|
2624
|
-
fileStatsList: FileStats[]
|
2625
|
-
}
|
2626
|
-
|
2627
|
-
/**
|
2628
|
-
* 创建目录,需要文件读写权限
|
2629
|
-
*/
|
2630
|
-
mkdir(params: {
|
2631
|
-
/** 创建的目录路径 (本地路径) */
|
2632
|
-
dirPath: string
|
2633
|
-
/**
|
2634
|
-
* 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。
|
2635
|
-
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,
|
2636
|
-
* 以此类推直至创建 a/b/c 目录下的 d 目录。
|
2637
|
-
* 默认值:false
|
2638
|
-
*/
|
2639
|
-
recursive?: boolean
|
2640
|
-
complete?: () => void
|
2641
|
-
success?: (params: null) => void
|
2642
|
-
fail?: (params: {
|
2643
|
-
errorMsg: string
|
2644
|
-
errorCode: string | number
|
2645
|
-
innerError: {
|
2646
|
-
errorCode: string | number
|
2647
|
-
errorMsg: string
|
2648
|
-
}
|
2649
|
-
}) => void
|
2650
|
-
}): void
|
2651
|
-
|
2652
|
-
/**
|
2653
|
-
* 创建目录,需要文件读写权限
|
2654
|
-
*/
|
2655
|
-
mkdirSync(params?: MakeDirParams): null
|
2656
|
-
|
2657
|
-
/**
|
2658
|
-
* 删除目录,需要文件读写权限
|
2659
|
-
*/
|
2660
|
-
rmdir(params: {
|
2661
|
-
/** 要删除的目录路径 (本地路径) */
|
2662
|
-
dirPath: string
|
2663
|
-
/**
|
2664
|
-
* 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
|
2665
|
-
* 默认值:false
|
2666
|
-
*/
|
2667
|
-
recursive?: boolean
|
2668
|
-
complete?: () => void
|
2669
|
-
success?: (params: null) => void
|
2670
|
-
fail?: (params: {
|
2671
|
-
errorMsg: string
|
2672
|
-
errorCode: string | number
|
2673
|
-
innerError: {
|
2674
|
-
errorCode: string | number
|
2675
|
-
errorMsg: string
|
2676
|
-
}
|
2677
|
-
}) => void
|
2678
|
-
}): void
|
2679
|
-
|
2680
|
-
/**
|
2681
|
-
* 删除目录,需要文件读写权限
|
2682
|
-
*/
|
2683
|
-
rmdirSync(params?: RemoveDirParams): null
|
2684
|
-
|
2685
|
-
/**
|
2686
|
-
* 写文件,需要文件读写权限
|
2687
|
-
*/
|
2688
|
-
writeFile(params: {
|
2689
|
-
/** 要写入的文件路径 (本地路径) */
|
2690
|
-
filePath: string
|
2691
|
-
/** 要写入的文本数据, 根据encoding编码 */
|
2692
|
-
data: string
|
2693
|
-
/** 指定写入文件的字符编码,目前支持【utf8、ascii、base64】, 默认utf8 */
|
2694
|
-
encoding?: string
|
2695
|
-
complete?: () => void
|
2696
|
-
success?: (params: null) => void
|
2697
|
-
fail?: (params: {
|
2698
|
-
errorMsg: string
|
2699
|
-
errorCode: string | number
|
2700
|
-
innerError: {
|
2701
|
-
errorCode: string | number
|
2702
|
-
errorMsg: string
|
2703
|
-
}
|
2704
|
-
}) => void
|
2705
|
-
}): void
|
2706
|
-
|
2707
|
-
/**
|
2708
|
-
* 写文件,需要文件读写权限
|
2709
|
-
*/
|
2710
|
-
writeFileSync(params?: WriteFileParams): null
|
2711
|
-
|
2712
|
-
/**
|
2713
|
-
* 删除已保存的本地缓存文件,需要文件读写权限
|
2714
|
-
*/
|
2715
|
-
removeSavedFile(params: {
|
2716
|
-
/** 需要删除的文件路径 (本地路径) */
|
2717
|
-
filePath: string
|
2718
|
-
complete?: () => void
|
2719
|
-
success?: (params: null) => void
|
2720
|
-
fail?: (params: {
|
2721
|
-
errorMsg: string
|
2722
|
-
errorCode: string | number
|
2723
|
-
innerError: {
|
2724
|
-
errorCode: string | number
|
2725
|
-
errorMsg: string
|
2726
|
-
}
|
2727
|
-
}) => void
|
2728
|
-
}): void
|
2729
|
-
}
|
2730
|
-
export function getFileSystemManager(params?: {
|
2731
|
-
complete?: () => void
|
2732
|
-
success?: (params: null) => void
|
2733
|
-
fail?: (params: {
|
2734
|
-
errorMsg: string
|
2735
|
-
errorCode: string | number
|
2736
|
-
innerError: {
|
2737
|
-
errorCode: string | number
|
2738
|
-
errorMsg: string
|
2739
|
-
}
|
2740
|
-
}) => void
|
2741
|
-
}): GetFileSystemManagerTask
|
2742
|
-
|
2743
|
-
/**
|
2744
|
-
* 获取网络请求任务对象RequestTask
|
2745
|
-
*/
|
2746
|
-
interface RequestTask {
|
2747
|
-
/**
|
2748
|
-
* 中断请求任务
|
2749
|
-
*/
|
2750
|
-
abort(params: {
|
2751
|
-
complete?: () => void
|
2752
|
-
success?: (params: null) => void
|
2753
|
-
failure?: (params: {
|
2754
|
-
errorMsg: string
|
2755
|
-
errorCode: string | number
|
2756
|
-
innerError: {
|
2757
|
-
errorCode: string | number
|
2758
|
-
errorMsg: string
|
2759
|
-
}
|
2760
|
-
}) => void
|
2761
|
-
}): void
|
2762
|
-
|
2763
|
-
/**
|
2764
|
-
* 监听 HTTP Response Header 事件。会比请求完成事件更早
|
2765
|
-
*/
|
2766
|
-
onHeadersReceived(
|
2767
|
-
listener: (params: {
|
2768
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
2769
|
-
header: Record<string, string>
|
2770
|
-
/** 网络请求id */
|
2771
|
-
requestId: string
|
2772
|
-
}) => void
|
2773
|
-
): void
|
2774
|
-
|
2775
|
-
/**
|
2776
|
-
* 取消监听 HTTP Response Header 事件
|
2777
|
-
*/
|
2778
|
-
offHeadersReceived(
|
2779
|
-
listener: (params: {
|
2780
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
2781
|
-
header: Record<string, string>
|
2782
|
-
/** 网络请求id */
|
2783
|
-
requestId: string
|
2784
|
-
}) => void
|
2785
|
-
): void
|
2786
|
-
}
|
2787
|
-
export function request(params: {
|
2788
|
-
/** 开发者服务器接口地址 */
|
2789
|
-
url: string
|
2790
|
-
/** 请求的参数 */
|
2791
|
-
data?: string
|
2792
|
-
/** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
|
2793
|
-
header?: Record<string, string>
|
2794
|
-
/** 超时时间,单位为毫秒 */
|
2795
|
-
timeout?: number
|
2796
|
-
/** HTTP 请求方法 */
|
2797
|
-
method?: HTTPMethod
|
2798
|
-
/** 返回的数据格式 */
|
2799
|
-
dataType?: any
|
2800
|
-
/** 返回的数据类型 */
|
2801
|
-
responseType?: string
|
2802
|
-
/** enableHttp2 */
|
2803
|
-
enableHttp2?: boolean
|
2804
|
-
/** enableQuic */
|
2805
|
-
enableQuic?: boolean
|
2806
|
-
/** enableCache */
|
2807
|
-
enableCache?: boolean
|
2808
|
-
complete?: () => void
|
2809
|
-
success?: (params: {
|
2810
|
-
/** 开发者服务器返回的数据 */
|
2811
|
-
data: string
|
2812
|
-
/** 开发者服务器返回的 HTTP 状态码 */
|
2813
|
-
statusCode: number
|
2814
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
2815
|
-
header: Record<string, string>
|
2816
|
-
/** 开发者服务器返回的 cookies,格式为字符串数组 */
|
2817
|
-
cookies: string[]
|
2818
|
-
/** 网络请求过程中一些调试信息 */
|
2819
|
-
profile: Profile
|
2820
|
-
/** 网络请求id,用户取消、监听等操作 */
|
2821
|
-
taskId: string
|
2822
|
-
}) => void
|
2823
|
-
failure?: (params: {
|
2824
|
-
errorMsg: string
|
2825
|
-
errorCode: string | number
|
2826
|
-
innerError: {
|
2827
|
-
errorCode: string | number
|
2828
|
-
errorMsg: string
|
2829
|
-
}
|
2830
|
-
}) => void
|
2831
|
-
}): RequestTask
|
2297
|
+
innerError: {
|
2298
|
+
errorCode: string | number
|
2299
|
+
errorMsg: string
|
2300
|
+
}
|
2301
|
+
}) => void
|
2302
|
+
}): void
|
2832
2303
|
|
2833
|
-
/**
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2304
|
+
/**
|
2305
|
+
* 播放
|
2306
|
+
*/
|
2307
|
+
play(params: {
|
2308
|
+
/** src 音频资源的地址 */
|
2309
|
+
src: string
|
2310
|
+
/** startTime 开始播放的位置 */
|
2311
|
+
startTime?: number
|
2312
|
+
/** autoplay 是否自动开始播放 */
|
2313
|
+
autoplay?: boolean
|
2314
|
+
/** 是否循环播放,默认为 false */
|
2315
|
+
loop?: boolean
|
2316
|
+
/** 音量。范围 0~1。默认为 1 */
|
2317
|
+
volume?: number
|
2318
|
+
/** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
|
2319
|
+
playbackRate?: number
|
2320
|
+
complete?: () => void
|
2321
|
+
success?: (params: null) => void
|
2322
|
+
fail?: (params: {
|
2323
|
+
errorMsg: string
|
2324
|
+
errorCode: string | number
|
2325
|
+
innerError: {
|
2326
|
+
errorCode: string | number
|
2327
|
+
errorMsg: string
|
2328
|
+
}
|
2329
|
+
}) => void
|
2330
|
+
}): void
|
2331
|
+
|
2332
|
+
/**
|
2333
|
+
* 跳转到指定位置
|
2334
|
+
*/
|
2335
|
+
seek(params: {
|
2336
|
+
/** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
|
2337
|
+
position?: number
|
2338
|
+
complete?: () => void
|
2339
|
+
success?: (params: null) => void
|
2340
|
+
fail?: (params: {
|
2341
|
+
errorMsg: string
|
2342
|
+
errorCode: string | number
|
2343
|
+
innerError: {
|
2344
|
+
errorCode: string | number
|
2345
|
+
errorMsg: string
|
2346
|
+
}
|
2347
|
+
}) => void
|
2348
|
+
}): void
|
2349
|
+
|
2350
|
+
/**
|
2351
|
+
* 停止。停止后的音频再播放会从头开始播放
|
2352
|
+
*/
|
2353
|
+
stop(params: {
|
2354
|
+
complete?: () => void
|
2355
|
+
success?: (params: null) => void
|
2356
|
+
fail?: (params: {
|
2357
|
+
errorMsg: string
|
2358
|
+
errorCode: string | number
|
2359
|
+
innerError: {
|
2360
|
+
errorCode: string | number
|
2361
|
+
errorMsg: string
|
2362
|
+
}
|
2363
|
+
}) => void
|
2364
|
+
}): void
|
2365
|
+
|
2366
|
+
/**
|
2367
|
+
* 销毁当前实例
|
2368
|
+
*/
|
2369
|
+
destroy(params: {
|
2370
|
+
complete?: () => void
|
2371
|
+
success?: (params: null) => void
|
2372
|
+
fail?: (params: {
|
2373
|
+
errorMsg: string
|
2374
|
+
errorCode: string | number
|
2375
|
+
innerError: {
|
2376
|
+
errorCode: string | number
|
2377
|
+
errorMsg: string
|
2378
|
+
}
|
2379
|
+
}) => void
|
2380
|
+
}): void
|
2381
|
+
|
2382
|
+
/**
|
2383
|
+
* 监听音频播放进度更新事件
|
2384
|
+
*/
|
2385
|
+
onTimeUpdate(
|
2386
|
+
listener: (params: {
|
2387
|
+
/** InnerAudioContext 对象 ContextId */
|
2388
|
+
contextId: string
|
2389
|
+
/** 播放进度 【0 - 1】 */
|
2390
|
+
time: number
|
2391
|
+
}) => void
|
2392
|
+
): void
|
2393
|
+
}
|
2394
|
+
export function createInnerAudioContext(params?: {
|
2855
2395
|
complete?: () => void
|
2856
|
-
success?: (params:
|
2857
|
-
|
2858
|
-
tempFilePath: string
|
2859
|
-
}) => void
|
2860
|
-
failure?: (params: {
|
2396
|
+
success?: (params: null) => void
|
2397
|
+
fail?: (params: {
|
2861
2398
|
errorMsg: string
|
2862
2399
|
errorCode: string | number
|
2863
2400
|
innerError: {
|
@@ -2865,16 +2402,103 @@ interface GetRecorderManagerTask {
|
|
2865
2402
|
errorMsg: string
|
2866
2403
|
}
|
2867
2404
|
}) => void
|
2868
|
-
}):
|
2405
|
+
}): CreateInnerAudioContextTask
|
2869
2406
|
|
2870
2407
|
/**
|
2871
|
-
*
|
2408
|
+
* 一个可以监听下载进度变化事件,以及取消下载任务的对象
|
2872
2409
|
*/
|
2873
|
-
|
2410
|
+
interface DownloadFileTask {
|
2411
|
+
/**
|
2412
|
+
* 中断下载任务
|
2413
|
+
*/
|
2414
|
+
abort(params: {
|
2415
|
+
complete?: () => void
|
2416
|
+
success?: (params: null) => void
|
2417
|
+
failure?: (params: {
|
2418
|
+
errorMsg: string
|
2419
|
+
errorCode: string | number
|
2420
|
+
innerError: {
|
2421
|
+
errorCode: string | number
|
2422
|
+
errorMsg: string
|
2423
|
+
}
|
2424
|
+
}) => void
|
2425
|
+
}): void
|
2426
|
+
|
2427
|
+
/**
|
2428
|
+
* 监听 HTTP Response Header 事件。会比请求完成事件更早
|
2429
|
+
*/
|
2430
|
+
onHeadersReceived(
|
2431
|
+
listener: (params: {
|
2432
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
2433
|
+
header: Record<string, string>
|
2434
|
+
/** 网络请求id */
|
2435
|
+
requestId: string
|
2436
|
+
}) => void
|
2437
|
+
): void
|
2438
|
+
|
2439
|
+
/**
|
2440
|
+
* 取消监听 HTTP Response Header 事件
|
2441
|
+
*/
|
2442
|
+
offHeadersReceived(
|
2443
|
+
listener: (params: {
|
2444
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
2445
|
+
header: Record<string, string>
|
2446
|
+
/** 网络请求id */
|
2447
|
+
requestId: string
|
2448
|
+
}) => void
|
2449
|
+
): void
|
2450
|
+
|
2451
|
+
/**
|
2452
|
+
* 监听下载进度变化事件
|
2453
|
+
*/
|
2454
|
+
onProgressUpdate(
|
2455
|
+
listener: (params: {
|
2456
|
+
/** 下载进度百分比 */
|
2457
|
+
progress: number
|
2458
|
+
/** 已经下载的数据长度,单位 Bytes */
|
2459
|
+
totalBytesSent: number
|
2460
|
+
/** 预期需要下载的数据总长度,单位 Bytes */
|
2461
|
+
totalBytesExpectedToSend: number
|
2462
|
+
/** 网络请求id */
|
2463
|
+
requestId: string
|
2464
|
+
}) => void
|
2465
|
+
): void
|
2466
|
+
|
2467
|
+
/**
|
2468
|
+
* 取消监听下载进度变化事件
|
2469
|
+
*/
|
2470
|
+
offProgressUpdate(
|
2471
|
+
listener: (params: {
|
2472
|
+
/** 下载进度百分比 */
|
2473
|
+
progress: number
|
2474
|
+
/** 已经下载的数据长度,单位 Bytes */
|
2475
|
+
totalBytesSent: number
|
2476
|
+
/** 预期需要下载的数据总长度,单位 Bytes */
|
2477
|
+
totalBytesExpectedToSend: number
|
2478
|
+
/** 网络请求id */
|
2479
|
+
requestId: string
|
2480
|
+
}) => void
|
2481
|
+
): void
|
2482
|
+
}
|
2483
|
+
export function downloadFile(params: {
|
2484
|
+
/** 下载资源的 url */
|
2485
|
+
url: string
|
2486
|
+
/** HTTP 请求的 Header,Header 中不能设置 Referer */
|
2487
|
+
header?: Record<string, string>
|
2488
|
+
/** 超时时间,单位为毫秒 */
|
2489
|
+
timeout?: number
|
2490
|
+
/** 指定文件下载后存储的路径 (本地路径) */
|
2491
|
+
filePath?: string
|
2874
2492
|
complete?: () => void
|
2875
2493
|
success?: (params: {
|
2876
|
-
/**
|
2494
|
+
/** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
|
2877
2495
|
tempFilePath: string
|
2496
|
+
/** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
|
2497
|
+
filePath: string
|
2498
|
+
/** 开发者服务器返回的 HTTP 状态码 */
|
2499
|
+
statusCode: number
|
2500
|
+
/** 网络请求过程中一些调试信息 */
|
2501
|
+
profile: Profile
|
2878
2502
|
}) => void
|
2879
2503
|
failure?: (params: {
|
2880
2504
|
errorMsg: string
|
@@ -2884,37 +2508,240 @@ interface GetRecorderManagerTask {
|
|
2884
2508
|
errorMsg: string
|
2885
2509
|
}
|
2886
2510
|
}) => void
|
2887
|
-
}):
|
2511
|
+
}): DownloadFileTask
|
2888
2512
|
|
2889
2513
|
/**
|
2890
|
-
*
|
2514
|
+
* 文件管理器
|
2891
2515
|
*/
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2516
|
+
interface GetFileSystemManagerTask {
|
2517
|
+
/**
|
2518
|
+
* 判断文件/目录是否存在
|
2519
|
+
*/
|
2520
|
+
access(params: {
|
2521
|
+
/** 要判断是否存在的文件/目录路径 (本地路径) */
|
2522
|
+
path: string
|
2523
|
+
complete?: () => void
|
2524
|
+
success?: (params: null) => void
|
2525
|
+
fail?: (params: {
|
2526
|
+
errorMsg: string
|
2527
|
+
errorCode: string | number
|
2528
|
+
innerError: {
|
2529
|
+
errorCode: string | number
|
2530
|
+
errorMsg: string
|
2531
|
+
}
|
2532
|
+
}) => void
|
2533
|
+
}): void
|
2534
|
+
|
2535
|
+
/**
|
2536
|
+
* 读取本地文件内容
|
2537
|
+
*/
|
2538
|
+
readFile(params: {
|
2539
|
+
/** 要写入的文件路径 (本地路径) */
|
2540
|
+
filePath: string
|
2541
|
+
/**
|
2542
|
+
* 指定读取文件的字符编码。
|
2543
|
+
* 支持 utf8/ascii/base64。如果不传 encoding,默认utf8
|
2544
|
+
*/
|
2545
|
+
encoding?: string
|
2546
|
+
/** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
|
2547
|
+
position?: number
|
2548
|
+
/** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
|
2549
|
+
length?: number
|
2550
|
+
complete?: () => void
|
2551
|
+
success?: (params: {
|
2552
|
+
/** 文件内容 */
|
2553
|
+
data: string
|
2554
|
+
}) => void
|
2555
|
+
fail?: (params: {
|
2556
|
+
errorMsg: string
|
2557
|
+
errorCode: string | number
|
2558
|
+
innerError: {
|
2559
|
+
errorCode: string | number
|
2560
|
+
errorMsg: string
|
2561
|
+
}
|
2562
|
+
}) => void
|
2563
|
+
}): void
|
2564
|
+
|
2565
|
+
/**
|
2566
|
+
* 读取本地文件内容
|
2567
|
+
*/
|
2568
|
+
readFileSync(req?: FileReadFileReqBean): {
|
2569
|
+
/** 文件内容 */
|
2570
|
+
data: string
|
2571
|
+
}
|
2572
|
+
|
2573
|
+
/**
|
2574
|
+
* 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
|
2575
|
+
*/
|
2576
|
+
saveFile(params: {
|
2577
|
+
/** 临时存储文件路径 */
|
2896
2578
|
tempFilePath: string
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2579
|
+
/** 要存储的文件路径 */
|
2580
|
+
filePath: string
|
2581
|
+
complete?: () => void
|
2582
|
+
success?: (params: {
|
2583
|
+
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
2584
|
+
savedFilePath: string
|
2585
|
+
}) => void
|
2586
|
+
fail?: (params: {
|
2587
|
+
errorMsg: string
|
2588
|
+
errorCode: string | number
|
2589
|
+
innerError: {
|
2590
|
+
errorCode: string | number
|
2591
|
+
errorMsg: string
|
2592
|
+
}
|
2593
|
+
}) => void
|
2594
|
+
}): void
|
2595
|
+
|
2596
|
+
/**
|
2597
|
+
* 文件保存的同步方法, 在完成文件保存后调用回调, 需要与getTempDirectory配合使用, 目标路径会校验是否包含getTempDirectory前缀
|
2598
|
+
*/
|
2599
|
+
saveFileSync(params?: SaveFileSyncParams): {
|
2600
|
+
/** 【待废弃, 不建议使用】存储后的文件路径 */
|
2601
|
+
savedFilePath: string
|
2602
|
+
}
|
2603
|
+
|
2604
|
+
/**
|
2605
|
+
* 获取文件Stats对象,需要文件读写权限
|
2606
|
+
*/
|
2607
|
+
stat(params: {
|
2608
|
+
/** 文件/目录路径 (本地路径) */
|
2609
|
+
path: string
|
2610
|
+
/**
|
2611
|
+
* 是否递归获取目录下的每个文件的 Stats 信息
|
2612
|
+
* 默认值:false
|
2613
|
+
*/
|
2614
|
+
recursive?: boolean
|
2615
|
+
complete?: () => void
|
2616
|
+
success?: (params: {
|
2617
|
+
/** 文件列表 */
|
2618
|
+
fileStatsList: FileStats[]
|
2619
|
+
}) => void
|
2620
|
+
fail?: (params: {
|
2621
|
+
errorMsg: string
|
2622
|
+
errorCode: string | number
|
2623
|
+
innerError: {
|
2624
|
+
errorCode: string | number
|
2625
|
+
errorMsg: string
|
2626
|
+
}
|
2627
|
+
}) => void
|
2628
|
+
}): void
|
2629
|
+
|
2630
|
+
/**
|
2631
|
+
* 获取文件Stats对象,需要文件读写权限
|
2632
|
+
*/
|
2633
|
+
statSync(params?: FileStatsParams): {
|
2634
|
+
/** 文件列表 */
|
2635
|
+
fileStatsList: FileStats[]
|
2636
|
+
}
|
2637
|
+
|
2638
|
+
/**
|
2639
|
+
* 创建目录,需要文件读写权限
|
2640
|
+
*/
|
2641
|
+
mkdir(params: {
|
2642
|
+
/** 创建的目录路径 (本地路径) */
|
2643
|
+
dirPath: string
|
2644
|
+
/**
|
2645
|
+
* 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。
|
2646
|
+
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,
|
2647
|
+
* 以此类推直至创建 a/b/c 目录下的 d 目录。
|
2648
|
+
* 默认值:false
|
2649
|
+
*/
|
2650
|
+
recursive?: boolean
|
2651
|
+
complete?: () => void
|
2652
|
+
success?: (params: null) => void
|
2653
|
+
fail?: (params: {
|
2654
|
+
errorMsg: string
|
2902
2655
|
errorCode: string | number
|
2656
|
+
innerError: {
|
2657
|
+
errorCode: string | number
|
2658
|
+
errorMsg: string
|
2659
|
+
}
|
2660
|
+
}) => void
|
2661
|
+
}): void
|
2662
|
+
|
2663
|
+
/**
|
2664
|
+
* 创建目录,需要文件读写权限
|
2665
|
+
*/
|
2666
|
+
mkdirSync(params?: MakeDirParams): null
|
2667
|
+
|
2668
|
+
/**
|
2669
|
+
* 删除目录,需要文件读写权限
|
2670
|
+
*/
|
2671
|
+
rmdir(params: {
|
2672
|
+
/** 要删除的目录路径 (本地路径) */
|
2673
|
+
dirPath: string
|
2674
|
+
/**
|
2675
|
+
* 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
|
2676
|
+
* 默认值:false
|
2677
|
+
*/
|
2678
|
+
recursive?: boolean
|
2679
|
+
complete?: () => void
|
2680
|
+
success?: (params: null) => void
|
2681
|
+
fail?: (params: {
|
2903
2682
|
errorMsg: string
|
2904
|
-
|
2905
|
-
|
2906
|
-
|
2683
|
+
errorCode: string | number
|
2684
|
+
innerError: {
|
2685
|
+
errorCode: string | number
|
2686
|
+
errorMsg: string
|
2687
|
+
}
|
2688
|
+
}) => void
|
2689
|
+
}): void
|
2907
2690
|
|
2908
|
-
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
2691
|
+
/**
|
2692
|
+
* 删除目录,需要文件读写权限
|
2693
|
+
*/
|
2694
|
+
rmdirSync(params?: RemoveDirParams): null
|
2695
|
+
|
2696
|
+
/**
|
2697
|
+
* 写文件,需要文件读写权限
|
2698
|
+
*/
|
2699
|
+
writeFile(params: {
|
2700
|
+
/** 要写入的文件路径 (本地路径) */
|
2701
|
+
filePath: string
|
2702
|
+
/** 要写入的文本数据, 根据encoding编码 */
|
2703
|
+
data: string
|
2704
|
+
/** 指定写入文件的字符编码,目前支持【utf8、ascii、base64】, 默认utf8 */
|
2705
|
+
encoding?: string
|
2706
|
+
complete?: () => void
|
2707
|
+
success?: (params: null) => void
|
2708
|
+
fail?: (params: {
|
2709
|
+
errorMsg: string
|
2710
|
+
errorCode: string | number
|
2711
|
+
innerError: {
|
2712
|
+
errorCode: string | number
|
2713
|
+
errorMsg: string
|
2714
|
+
}
|
2715
|
+
}) => void
|
2716
|
+
}): void
|
2717
|
+
|
2718
|
+
/**
|
2719
|
+
* 写文件,需要文件读写权限
|
2720
|
+
*/
|
2721
|
+
writeFileSync(params?: WriteFileParams): null
|
2722
|
+
|
2723
|
+
/**
|
2724
|
+
* 删除已保存的本地缓存文件,需要文件读写权限
|
2725
|
+
*/
|
2726
|
+
removeSavedFile(params: {
|
2727
|
+
/** 需要删除的文件路径 (本地路径) */
|
2728
|
+
filePath: string
|
2729
|
+
complete?: () => void
|
2730
|
+
success?: (params: null) => void
|
2731
|
+
fail?: (params: {
|
2732
|
+
errorMsg: string
|
2733
|
+
errorCode: string | number
|
2734
|
+
innerError: {
|
2735
|
+
errorCode: string | number
|
2736
|
+
errorMsg: string
|
2737
|
+
}
|
2738
|
+
}) => void
|
2739
|
+
}): void
|
2740
|
+
}
|
2741
|
+
export function getFileSystemManager(params?: {
|
2912
2742
|
complete?: () => void
|
2913
|
-
success?: (params:
|
2914
|
-
|
2915
|
-
tempFilePath: string
|
2916
|
-
}) => void
|
2917
|
-
failure?: (params: {
|
2743
|
+
success?: (params: null) => void
|
2744
|
+
fail?: (params: {
|
2918
2745
|
errorMsg: string
|
2919
2746
|
errorCode: string | number
|
2920
2747
|
innerError: {
|
@@ -2922,16 +2749,88 @@ interface GetRecorderManagerTask {
|
|
2922
2749
|
errorMsg: string
|
2923
2750
|
}
|
2924
2751
|
}) => void
|
2925
|
-
}):
|
2752
|
+
}): GetFileSystemManagerTask
|
2926
2753
|
|
2927
2754
|
/**
|
2928
|
-
*
|
2755
|
+
* 获取网络请求任务对象RequestTask
|
2929
2756
|
*/
|
2930
|
-
|
2931
|
-
/**
|
2932
|
-
|
2757
|
+
interface RequestTask {
|
2758
|
+
/**
|
2759
|
+
* 中断请求任务
|
2760
|
+
*/
|
2761
|
+
abort(params: {
|
2762
|
+
complete?: () => void
|
2763
|
+
success?: (params: null) => void
|
2764
|
+
failure?: (params: {
|
2765
|
+
errorMsg: string
|
2766
|
+
errorCode: string | number
|
2767
|
+
innerError: {
|
2768
|
+
errorCode: string | number
|
2769
|
+
errorMsg: string
|
2770
|
+
}
|
2771
|
+
}) => void
|
2772
|
+
}): void
|
2773
|
+
|
2774
|
+
/**
|
2775
|
+
* 监听 HTTP Response Header 事件。会比请求完成事件更早
|
2776
|
+
*/
|
2777
|
+
onHeadersReceived(
|
2778
|
+
listener: (params: {
|
2779
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
2780
|
+
header: Record<string, string>
|
2781
|
+
/** 网络请求id */
|
2782
|
+
requestId: string
|
2783
|
+
}) => void
|
2784
|
+
): void
|
2785
|
+
|
2786
|
+
/**
|
2787
|
+
* 取消监听 HTTP Response Header 事件
|
2788
|
+
*/
|
2789
|
+
offHeadersReceived(
|
2790
|
+
listener: (params: {
|
2791
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
2792
|
+
header: Record<string, string>
|
2793
|
+
/** 网络请求id */
|
2794
|
+
requestId: string
|
2795
|
+
}) => void
|
2796
|
+
): void
|
2797
|
+
}
|
2798
|
+
export function request(params: {
|
2799
|
+
/** 开发者服务器接口地址 */
|
2800
|
+
url: string
|
2801
|
+
/** 请求的参数 */
|
2802
|
+
data?: string
|
2803
|
+
/** 设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json */
|
2804
|
+
header?: Record<string, string>
|
2805
|
+
/** 超时时间,单位为毫秒 */
|
2806
|
+
timeout?: number
|
2807
|
+
/** HTTP 请求方法 */
|
2808
|
+
method?: HTTPMethod
|
2809
|
+
/** 返回的数据格式 */
|
2810
|
+
dataType?: any
|
2811
|
+
/** 返回的数据类型 */
|
2812
|
+
responseType?: string
|
2813
|
+
/** enableHttp2 */
|
2814
|
+
enableHttp2?: boolean
|
2815
|
+
/** enableQuic */
|
2816
|
+
enableQuic?: boolean
|
2817
|
+
/** enableCache */
|
2818
|
+
enableCache?: boolean
|
2933
2819
|
complete?: () => void
|
2934
|
-
success?: (params:
|
2820
|
+
success?: (params: {
|
2821
|
+
/** 开发者服务器返回的数据 */
|
2822
|
+
data: string
|
2823
|
+
/** 开发者服务器返回的 HTTP 状态码 */
|
2824
|
+
statusCode: number
|
2825
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
2826
|
+
header: Record<string, string>
|
2827
|
+
/** 开发者服务器返回的 cookies,格式为字符串数组 */
|
2828
|
+
cookies: string[]
|
2829
|
+
/** 网络请求过程中一些调试信息 */
|
2830
|
+
profile: Profile
|
2831
|
+
/** 网络请求id,用户取消、监听等操作 */
|
2832
|
+
taskId: string
|
2833
|
+
}) => void
|
2935
2834
|
failure?: (params: {
|
2936
2835
|
errorMsg: string
|
2937
2836
|
errorCode: string | number
|
@@ -2940,12 +2839,137 @@ interface GetRecorderManagerTask {
|
|
2940
2839
|
errorMsg: string
|
2941
2840
|
}
|
2942
2841
|
}) => void
|
2943
|
-
}):
|
2842
|
+
}): RequestTask
|
2944
2843
|
|
2945
2844
|
/**
|
2946
|
-
*
|
2845
|
+
* 获取全局唯一的录音管理器
|
2947
2846
|
*/
|
2948
|
-
|
2847
|
+
interface GetRecorderManagerTask {
|
2848
|
+
/**
|
2849
|
+
* 开始录音
|
2850
|
+
*/
|
2851
|
+
start(params: {
|
2852
|
+
/** 录音的时长,单位 ms,最大值 600000(10 分钟) */
|
2853
|
+
duration?: number
|
2854
|
+
/** 采样率 */
|
2855
|
+
sampleRate?: number
|
2856
|
+
/** 录音通道数 */
|
2857
|
+
numberOfChannels?: number
|
2858
|
+
/** 编码码率,有效值见下表格 */
|
2859
|
+
encodeBitRate?: number
|
2860
|
+
/** 音频格式 */
|
2861
|
+
format?: string
|
2862
|
+
/** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
|
2863
|
+
frameSize: number
|
2864
|
+
/** 指定录音的音频输入源 */
|
2865
|
+
audioSource?: string
|
2866
|
+
complete?: () => void
|
2867
|
+
success?: (params: {
|
2868
|
+
/** 录音文件的临时路径 (本地路径) */
|
2869
|
+
tempFilePath: string
|
2870
|
+
}) => void
|
2871
|
+
failure?: (params: {
|
2872
|
+
errorMsg: string
|
2873
|
+
errorCode: string | number
|
2874
|
+
innerError: {
|
2875
|
+
errorCode: string | number
|
2876
|
+
errorMsg: string
|
2877
|
+
}
|
2878
|
+
}) => void
|
2879
|
+
}): void
|
2880
|
+
|
2881
|
+
/**
|
2882
|
+
* 继续录音
|
2883
|
+
*/
|
2884
|
+
resume(params: {
|
2885
|
+
complete?: () => void
|
2886
|
+
success?: (params: {
|
2887
|
+
/** 录音文件的临时路径 (本地路径) */
|
2888
|
+
tempFilePath: string
|
2889
|
+
}) => void
|
2890
|
+
failure?: (params: {
|
2891
|
+
errorMsg: string
|
2892
|
+
errorCode: string | number
|
2893
|
+
innerError: {
|
2894
|
+
errorCode: string | number
|
2895
|
+
errorMsg: string
|
2896
|
+
}
|
2897
|
+
}) => void
|
2898
|
+
}): void
|
2899
|
+
|
2900
|
+
/**
|
2901
|
+
* 暂停录音
|
2902
|
+
*/
|
2903
|
+
pause(params: {
|
2904
|
+
complete?: () => void
|
2905
|
+
success?: (params: {
|
2906
|
+
/** 录音文件的临时路径 (本地路径) */
|
2907
|
+
tempFilePath: string
|
2908
|
+
}) => void
|
2909
|
+
failure?: (params: {
|
2910
|
+
errorMsg: string
|
2911
|
+
errorCode: string | number
|
2912
|
+
innerError: {
|
2913
|
+
errorCode: string | number
|
2914
|
+
errorMsg: string
|
2915
|
+
}
|
2916
|
+
}) => void
|
2917
|
+
}): void
|
2918
|
+
|
2919
|
+
/**
|
2920
|
+
* 停止录音
|
2921
|
+
*/
|
2922
|
+
stop(params: {
|
2923
|
+
complete?: () => void
|
2924
|
+
success?: (params: {
|
2925
|
+
/** 录音文件的临时路径 (本地路径) */
|
2926
|
+
tempFilePath: string
|
2927
|
+
}) => void
|
2928
|
+
failure?: (params: {
|
2929
|
+
errorMsg: string
|
2930
|
+
errorCode: string | number
|
2931
|
+
innerError: {
|
2932
|
+
errorCode: string | number
|
2933
|
+
errorMsg: string
|
2934
|
+
}
|
2935
|
+
}) => void
|
2936
|
+
}): void
|
2937
|
+
|
2938
|
+
/**
|
2939
|
+
* 开始持续录音
|
2940
|
+
*/
|
2941
|
+
startRecording(params: {
|
2942
|
+
/** 间隔时间 ms */
|
2943
|
+
period: number
|
2944
|
+
complete?: () => void
|
2945
|
+
success?: (params: null) => void
|
2946
|
+
failure?: (params: {
|
2947
|
+
errorMsg: string
|
2948
|
+
errorCode: string | number
|
2949
|
+
innerError: {
|
2950
|
+
errorCode: string | number
|
2951
|
+
errorMsg: string
|
2952
|
+
}
|
2953
|
+
}) => void
|
2954
|
+
}): void
|
2955
|
+
|
2956
|
+
/**
|
2957
|
+
* 停止持续录音
|
2958
|
+
*/
|
2959
|
+
stopRecording(params: {
|
2960
|
+
complete?: () => void
|
2961
|
+
success?: (params: null) => void
|
2962
|
+
failure?: (params: {
|
2963
|
+
errorMsg: string
|
2964
|
+
errorCode: string | number
|
2965
|
+
innerError: {
|
2966
|
+
errorCode: string | number
|
2967
|
+
errorMsg: string
|
2968
|
+
}
|
2969
|
+
}) => void
|
2970
|
+
}): void
|
2971
|
+
}
|
2972
|
+
export function getRecorderManager(params?: {
|
2949
2973
|
complete?: () => void
|
2950
2974
|
success?: (params: null) => void
|
2951
2975
|
failure?: (params: {
|
@@ -2956,31 +2980,104 @@ interface GetRecorderManagerTask {
|
|
2956
2980
|
errorMsg: string
|
2957
2981
|
}
|
2958
2982
|
}) => void
|
2959
|
-
}):
|
2960
|
-
}
|
2961
|
-
export function getRecorderManager(params?: {
|
2962
|
-
complete?: () => void
|
2963
|
-
success?: (params: null) => void
|
2964
|
-
failure?: (params: {
|
2965
|
-
errorMsg: string
|
2966
|
-
errorCode: string | number
|
2967
|
-
innerError: {
|
2968
|
-
errorCode: string | number
|
2969
|
-
errorMsg: string
|
2970
|
-
}
|
2971
|
-
}) => void
|
2972
|
-
}): GetRecorderManagerTask
|
2983
|
+
}): GetRecorderManagerTask
|
2973
2984
|
|
2974
|
-
/**
|
2975
|
-
* 获取网络请求任务对象RequestTask
|
2976
|
-
*/
|
2977
|
-
interface UploadFileTask {
|
2978
2985
|
/**
|
2979
|
-
*
|
2986
|
+
* 获取网络请求任务对象RequestTask
|
2980
2987
|
*/
|
2981
|
-
|
2988
|
+
interface UploadFileTask {
|
2989
|
+
/**
|
2990
|
+
* 中断上传任务
|
2991
|
+
*/
|
2992
|
+
abort(params: {
|
2993
|
+
complete?: () => void
|
2994
|
+
success?: (params: null) => void
|
2995
|
+
failure?: (params: {
|
2996
|
+
errorMsg: string
|
2997
|
+
errorCode: string | number
|
2998
|
+
innerError: {
|
2999
|
+
errorCode: string | number
|
3000
|
+
errorMsg: string
|
3001
|
+
}
|
3002
|
+
}) => void
|
3003
|
+
}): void
|
3004
|
+
|
3005
|
+
/**
|
3006
|
+
* 监听 HTTP Response Header 事件。会比请求完成事件更早
|
3007
|
+
*/
|
3008
|
+
onHeadersReceived(
|
3009
|
+
listener: (params: {
|
3010
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
3011
|
+
header: Record<string, string>
|
3012
|
+
/** 网络请求id */
|
3013
|
+
requestId: string
|
3014
|
+
}) => void
|
3015
|
+
): void
|
3016
|
+
|
3017
|
+
/**
|
3018
|
+
* 取消监听 HTTP Response Header 事件
|
3019
|
+
*/
|
3020
|
+
offHeadersReceived(
|
3021
|
+
listener: (params: {
|
3022
|
+
/** 开发者服务器返回的 HTTP Response Header */
|
3023
|
+
header: Record<string, string>
|
3024
|
+
/** 网络请求id */
|
3025
|
+
requestId: string
|
3026
|
+
}) => void
|
3027
|
+
): void
|
3028
|
+
|
3029
|
+
/**
|
3030
|
+
* 监听上传进度变化事件
|
3031
|
+
*/
|
3032
|
+
onProgressUpdate(
|
3033
|
+
listener: (params: {
|
3034
|
+
/** 下载进度百分比 */
|
3035
|
+
progress: number
|
3036
|
+
/** 已经下载的数据长度,单位 Bytes */
|
3037
|
+
totalBytesSent: number
|
3038
|
+
/** 预期需要下载的数据总长度,单位 Bytes */
|
3039
|
+
totalBytesExpectedToSend: number
|
3040
|
+
/** 网络请求id */
|
3041
|
+
requestId: string
|
3042
|
+
}) => void
|
3043
|
+
): void
|
3044
|
+
|
3045
|
+
/**
|
3046
|
+
* 取消监听上传进度变化事件
|
3047
|
+
*/
|
3048
|
+
offProgressUpdate(
|
3049
|
+
listener: (params: {
|
3050
|
+
/** 下载进度百分比 */
|
3051
|
+
progress: number
|
3052
|
+
/** 已经下载的数据长度,单位 Bytes */
|
3053
|
+
totalBytesSent: number
|
3054
|
+
/** 预期需要下载的数据总长度,单位 Bytes */
|
3055
|
+
totalBytesExpectedToSend: number
|
3056
|
+
/** 网络请求id */
|
3057
|
+
requestId: string
|
3058
|
+
}) => void
|
3059
|
+
): void
|
3060
|
+
}
|
3061
|
+
export function uploadFile(params: {
|
3062
|
+
/** 开发者服务器地址 */
|
3063
|
+
url: string
|
3064
|
+
/** 要上传文件资源的路径 (本地路径) */
|
3065
|
+
filePath: string
|
3066
|
+
/** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
|
3067
|
+
name: string
|
3068
|
+
/** HTTP 请求的 Header,Header 中不能设置 Referer */
|
3069
|
+
header?: Record<string, string>
|
3070
|
+
/** HTTP 请求中其他额外的 form data */
|
3071
|
+
formData?: Record<string, string>
|
3072
|
+
/** 超时时间,单位为毫秒 */
|
3073
|
+
timeout?: number
|
2982
3074
|
complete?: () => void
|
2983
|
-
success?: (params:
|
3075
|
+
success?: (params: {
|
3076
|
+
/** 开发者服务器返回的数据 */
|
3077
|
+
data: string
|
3078
|
+
/** 开发者服务器返回的 HTTP 状态码 */
|
3079
|
+
statusCode: number
|
3080
|
+
}) => void
|
2984
3081
|
failure?: (params: {
|
2985
3082
|
errorMsg: string
|
2986
3083
|
errorCode: string | number
|
@@ -2989,90 +3086,5 @@ interface UploadFileTask {
|
|
2989
3086
|
errorMsg: string
|
2990
3087
|
}
|
2991
3088
|
}) => void
|
2992
|
-
}):
|
2993
|
-
|
2994
|
-
/**
|
2995
|
-
* 监听 HTTP Response Header 事件。会比请求完成事件更早
|
2996
|
-
*/
|
2997
|
-
onHeadersReceived(
|
2998
|
-
listener: (params: {
|
2999
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
3000
|
-
header: Record<string, string>
|
3001
|
-
/** 网络请求id */
|
3002
|
-
requestId: string
|
3003
|
-
}) => void
|
3004
|
-
): void
|
3005
|
-
|
3006
|
-
/**
|
3007
|
-
* 取消监听 HTTP Response Header 事件
|
3008
|
-
*/
|
3009
|
-
offHeadersReceived(
|
3010
|
-
listener: (params: {
|
3011
|
-
/** 开发者服务器返回的 HTTP Response Header */
|
3012
|
-
header: Record<string, string>
|
3013
|
-
/** 网络请求id */
|
3014
|
-
requestId: string
|
3015
|
-
}) => void
|
3016
|
-
): void
|
3017
|
-
|
3018
|
-
/**
|
3019
|
-
* 监听上传进度变化事件
|
3020
|
-
*/
|
3021
|
-
onProgressUpdate(
|
3022
|
-
listener: (params: {
|
3023
|
-
/** 下载进度百分比 */
|
3024
|
-
progress: number
|
3025
|
-
/** 已经下载的数据长度,单位 Bytes */
|
3026
|
-
totalBytesSent: number
|
3027
|
-
/** 预期需要下载的数据总长度,单位 Bytes */
|
3028
|
-
totalBytesExpectedToSend: number
|
3029
|
-
/** 网络请求id */
|
3030
|
-
requestId: string
|
3031
|
-
}) => void
|
3032
|
-
): void
|
3033
|
-
|
3034
|
-
/**
|
3035
|
-
* 取消监听上传进度变化事件
|
3036
|
-
*/
|
3037
|
-
offProgressUpdate(
|
3038
|
-
listener: (params: {
|
3039
|
-
/** 下载进度百分比 */
|
3040
|
-
progress: number
|
3041
|
-
/** 已经下载的数据长度,单位 Bytes */
|
3042
|
-
totalBytesSent: number
|
3043
|
-
/** 预期需要下载的数据总长度,单位 Bytes */
|
3044
|
-
totalBytesExpectedToSend: number
|
3045
|
-
/** 网络请求id */
|
3046
|
-
requestId: string
|
3047
|
-
}) => void
|
3048
|
-
): void
|
3089
|
+
}): UploadFileTask
|
3049
3090
|
}
|
3050
|
-
export function uploadFile(params: {
|
3051
|
-
/** 开发者服务器地址 */
|
3052
|
-
url: string
|
3053
|
-
/** 要上传文件资源的路径 (本地路径) */
|
3054
|
-
filePath: string
|
3055
|
-
/** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
|
3056
|
-
name: string
|
3057
|
-
/** HTTP 请求的 Header,Header 中不能设置 Referer */
|
3058
|
-
header?: Record<string, string>
|
3059
|
-
/** HTTP 请求中其他额外的 form data */
|
3060
|
-
formData?: Record<string, string>
|
3061
|
-
/** 超时时间,单位为毫秒 */
|
3062
|
-
timeout?: number
|
3063
|
-
complete?: () => void
|
3064
|
-
success?: (params: {
|
3065
|
-
/** 开发者服务器返回的数据 */
|
3066
|
-
data: string
|
3067
|
-
/** 开发者服务器返回的 HTTP 状态码 */
|
3068
|
-
statusCode: number
|
3069
|
-
}) => void
|
3070
|
-
failure?: (params: {
|
3071
|
-
errorMsg: string
|
3072
|
-
errorCode: string | number
|
3073
|
-
innerError: {
|
3074
|
-
errorCode: string | number
|
3075
|
-
errorMsg: string
|
3076
|
-
}
|
3077
|
-
}) => void
|
3078
|
-
}): UploadFileTask
|