@yidun/livedetect-sdk-h5 2.3.0 → 2.3.2

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/README.md CHANGED
@@ -21,7 +21,7 @@ pc 浏览器需内置 chromium 内核且保证版本符合如下要求:
21
21
 
22
22
  | 浏览器 | 最低版本 |
23
23
  | ---------------------- | -------- |
24
- | Safari in iOS | 11 |
24
+ | Safari in iOS | 14.3 |
25
25
  | Android Browser | 99 |
26
26
  | Opera Mobile | 64 |
27
27
  | Chrome for Android | 99 |
@@ -30,8 +30,8 @@ pc 浏览器需内置 chromium 内核且保证版本符合如下要求:
30
30
  | Samsung Internet | 6.2 |
31
31
  | QQ Browser | 10.4 |
32
32
  | Opera Mini | 不支持 |
33
-
34
- 浏览器不支持时,会自动走降级方式(视频活体录制上传)。
33
+
34
+ 浏览器不支持时,会自动降级方式到视频活体,若不需要自动降级,可设置 `fallback` 为 `false`。
35
35
 
36
36
  ## 快速上手
37
37
 
@@ -39,51 +39,24 @@ pc 浏览器需内置 chromium 内核且保证版本符合如下要求:
39
39
 
40
40
  ### 资源引入
41
41
 
42
- 目前支持两种接入 SDK 方式。
43
-
44
- **1. 模块引入**
45
-
46
- 下载 `npm` 包:
42
+ 安装 `npm` 包:
47
43
 
48
44
  ```bash
49
45
  # npm
50
- npm install @yidun/livedetect-sdk-h5
46
+ npm install @yidun/livedetect-sdk-h5@latest
51
47
  # yarn
52
- yarn add @yidun/livedetect-sdk-h5
48
+ yarn add @yidun/livedetect-sdk-h5@latest
53
49
  # pnpm
54
- pnpm add @yidun/livedetect-sdk-h5
50
+ pnpm add @yidun/livedetect-sdk-h5@latest
55
51
  ```
56
52
 
57
- 在代码中引用:
53
+ 在代码中使用包
58
54
 
59
55
  ```js
60
56
  import NELiveDetection from '@yidun/livedetect-sdk-h5';
61
-
62
- // 样式文件引入
63
57
  import '@yidun/livedetect-sdk-h5/dist/es/NELiveDetection.css';
64
58
  ```
65
59
 
66
- **2. script 引入**
67
-
68
- `body` 标签下引入 `SDK`:
69
-
70
- ```html
71
- <!-- head 标签下样式文件引入 -->
72
- <link rel="stylesheet" href="https://yidunfe.nosdn.127.net/sdk/NELiveDetection.v<VERSION>.min.css" />
73
- <!-- body 标签下引入 sdk -->
74
- <script src="https://yidunfe.nosdn.127.net/sdk/NELiveDetection.v<VERSION>.umd.js"></script>
75
- ```
76
-
77
- <VERSION> 为占位符,详细版本列表见:https://www.npmjs.com/package/@yidun/livedetect-sdk-h5?activeTab=versions
78
-
79
- 引入该脚本之后,不需要像**模块引入**方式一样通过 `import` 引入 `NELiveDetection` 变量,该变量已经挂载到全局,初始化时直接按下列方式即可:
80
-
81
- ```js
82
- const neLiveDetection = new NELiveDetection({
83
- // ...
84
- });
85
- ```
86
-
87
60
  ## 快速调用示例
88
61
 
89
62
  请注意,示例需要启动一个本地服务(比如 vscode 的 LiveServer、vue-cli 的 serve 或 webpack 的 devServer,并且必须是 https 方式,不然会提示`浏览器不支持`。
@@ -117,7 +90,7 @@ const neLiveDetection = new NELiveDetection({
117
90
  <script>
118
91
  (function () {
119
92
  const neLiveDetection = new NELiveDetection({
120
- businessKey: '易盾申请的 businessKey',
93
+ businessKey: '易盾申请的 businessKey(传入业务ID,非密钥信息)',
121
94
  container: '#NELiveDetection',
122
95
  diameter: 220,
123
96
  onMount: (instance) => {},
@@ -168,12 +141,11 @@ const neLiveDetection = new NELiveDetection({
168
141
  | diameter | Number | `220` | 图像显示区域大小,单位为 `px` | 否 |
169
142
  | audio | Boolean | `false` | 摄像头唤起时是否开启声音录制 | 否 |
170
143
  | footerTip | Boolean | `true` | 是否显示底部图像和文字提示 | 否 |
171
- | lang | String | `zh-CN` | 语言,支持列表见下方语言支持列表 | 否 |
172
- | fallback | Boolean | `true` | 是否降级到视频录制上传 | 否 |
173
- | preload | Boolean | `false` | 初始化是否开启预加载,开启后模型会提前加载和解析 | |
144
+ | lang | string | `zh-CN` | 语言,支持列表见下方语言支持列表 | 否 |
145
+ | fallback | Boolean | `true` | 是否降级到视频录制上传(2.1.0支持) | 否 |
146
+ | preload | Boolean | `false` | 初始化是否开启预加载,开启后模型会提前加载和解析| |
174
147
  | onMount | Function | - | 初始化实例挂载完成回调 | 否 |
175
148
  | onReady | Function | - | 活体检测前的准备工作已完成回调 | 否 |
176
- | apiServer | String | https://verify.dun.163yun.com | 私有化接口服务地址,仅支持以 `https` 开头的域名,版本需要大于 2.2.0 | 否 |
177
149
 
178
150
  <md-attention>
179
151
 
@@ -278,7 +250,7 @@ instance.on('error', (err) => {
278
250
  | 10001 | 校验接口网络错误 |
279
251
  | 11000 | 获取相机权限失败 |
280
252
  | 11001 | 鉴权不通过 |
281
- | 11002 | 浏览器不支持,默认降级到视频活体,如不需要,可以将初始化参数 `fallback` 设置为 `false` |
253
+ | 11002 | 浏览器不支持,默认降级到视频活体,如不需要,可以将初始化参数 fallback 设置为 false |
282
254
  | 11003 | 用户拒绝相机权限授权 |
283
255
  | 11004 | 找不到摄像头 |
284
256
  | 11005 | 异常硬件导致无法读取摄像头 |
@@ -1 +1 @@
1
- .ne-live-detection{display:flex;flex-direction:column;height:100%;position:relative;width:100%}.ne-live-detection_tip{color:#222;font-size:22px;font-weight:600;text-align:center;width:100%}.ne-live-detection_camera{margin-top:60px;position:relative;width:100%}.ne-live-detection_camera_inner{align-items:center;background-color:#fff;border-radius:50%;display:flex;height:220px;justify-content:center;margin:0 auto;-webkit-mask-image:-webkit-radial-gradient(#fff,#fff);overflow:hidden;position:relative;width:220px;z-index:20}.ne-live-detection_camera_loading-text{align-items:center;background-color:#161616;display:flex;display:none;font-size:20px;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%}.ne-live-detection_camera_loading-text--show{display:flex}.ne-live-detection_camera_loading-bg{background-color:#161616;border-radius:50%;left:0;position:absolute;top:0;width:100%}.ne-live-detection_camera_loading-circle{animation:spin 2s linear infinite;border:4px solid transparent;border-radius:50%;border-top-color:#48dd69;bottom:0;content:"";left:0;position:absolute;right:0;top:0}.ne-live-detection_camera_loading-msg{color:#fff;font-size:14px;left:50%;letter-spacing:0;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%)}.ne-live-detection_camera_circle-bg{border:2px solid #eceef9;border-radius:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:30}.ne-live-detection_camera_circle-animation{border:2px solid transparent;border-radius:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:40}.ne-live-detection_progress{align-items:center;display:flex;flex-wrap:nowrap;justify-content:center;margin-top:60px}.ne-live-detection_progress_step{background:#dde3ef;border-radius:100%;font-size:0;height:10px;margin:0 8px;width:10px}.ne-live-detection_progress_step--active{align-items:center;background:#2b63ff;color:#fff;display:flex;font-size:12px;font-weight:600;height:20px;justify-content:center;width:20px}.ne-live-detection_footer{align-items:flex-start;display:flex;flex:1;justify-content:space-around;margin-top:60px;width:100%}.ne-live-detection_footer_icon-wrap{align-items:center;display:flex;flex:1;flex-direction:column;padding:0 4px}.ne-live-detection_footer_icon{height:32px;width:32px}.ne-live-detection_footer_text{color:#8a8a99;font-size:14px;margin:16px 0 0;text-align:center}.ne-live-detection_color{height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.ne-live-detection_color_circle{animation:scale .3s linear;animation-fill-mode:forwards;animation-play-state:paused;border-radius:50%;display:none;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%) scale(1)}.ne-live-detection_color_circle--active{animation-play-state:running;display:block}.ne-live-detection_record{background:#fff;bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:50}.ne-live-detection_record-checking,.ne-live-detection_record-fail,.ne-live-detection_record-start{align-items:center;display:flex;flex-direction:column;height:100%;width:100%}.ne-live-detection_record-tip-icon{height:140px;margin-top:70px;width:140px}.ne-live-detection_record-ani-wrapper{height:80px;margin:70px 0 32px;position:relative;text-align:center;width:80px}.ne-live-detection_record-tip-main{color:rgba(34,34,34,.85);font-size:26px;font-weight:600;line-height:46px}.ne-live-detection_record-tip-sub{color:rgba(34,34,34,.85);font-size:18px;line-height:32px;text-align:center}.ne-live-detection_record-tip-third{color:hsla(0,0%,40%,.85);font-size:18px;margin-top:16px;padding:0 60px;text-align:center}.ne-live-detection_record-condition-wrapper{box-sizing:border-box;margin-top:16px;padding:0 60px;width:100%}.ne-live-detection_record-condition-inner{margin-top:16px}.ne-live-detection_record-condition-icon{height:24px;margin-right:4px;vertical-align:middle;width:24px}.ne-live-detection_record-condition-text{color:#8a8a99;font-size:16px;line-height:1;vertical-align:middle}.ne-live-detection_record-btn-wrapper{box-sizing:border-box;margin-top:38px;padding:0 60px;position:relative;width:100%}.ne-live-detection_record-btn{background:linear-gradient(115deg,#60b1fe -38.66%,#6551f6 106.74%);border:none;border-radius:24px;box-sizing:border-box;color:#fff;font-size:18px;height:48px;outline:none;width:100%}.ne-live-detection_record-file-input{box-sizing:border-box;display:block;height:48px;margin-top:-48px;opacity:0;width:100%}.ne-live-detection_record-ani-scan{animation:scan 2s linear infinite;background:#5bdefe;box-shadow:0 4px 8px rgba(43,162,255,.56),0 18px 34px rgba(30,132,255,.732);height:4px;left:0;position:absolute;top:0;width:100%}.ne-live-detection_record-ani-img{height:100%}.ne-live-detection_toast{word-wrap:break-word;background:hsla(0,0%,8%,.8);background-color:rgba(0,0,0,.749);border-radius:2px;box-shadow:0 3px 6px -4px rgba(0,0,0,.122),0 6px 16px rgba(0,0,0,.078),0 9px 28px 8px rgba(0,0,0,.051);color:#fff;font-size:14px;padding:6px 8px;position:absolute;text-align:left;text-decoration:none;white-space:nowrap}.ne-live-detection_toast_center{left:50%;top:284px;transform:translateX(-50%)}#ne-live-detection_camera_video{background-color:transparent}#ne-live-detection_camera_video::-webkit-media-controls-panel,#ne-live-detection_camera_video::-webkit-media-controls-play-button{-webkit-appearance:none;display:none!important}#ne-live-detection_camera_video::-webkit-media-controls-start-playback-button{-webkit-appearance:none;display:none!important}@keyframes scale{0%{transform:translate(-50%,-50%) scale(1)}to{transform:translate(-50%,-50%) scale(6)}}@keyframes scan{0%{top:0}to{top:100%}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
1
+ .ne-live-detection{display:flex;flex-direction:column;height:100%;position:relative;width:100%}.ne-live-detection_tip{color:#222;font-size:22px;font-weight:600;text-align:center;width:100%}.ne-live-detection_camera{margin-top:60px;position:relative;width:100%}.ne-live-detection_camera_inner{align-items:center;background-color:#fff;border-radius:50%;display:flex;height:220px;justify-content:center;margin:0 auto;-webkit-mask-image:-webkit-radial-gradient(#fff,#fff);overflow:hidden;position:relative;width:220px;z-index:20}.ne-live-detection_camera_loading-text{align-items:center;background-color:#161616;display:flex;display:none;font-size:20px;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%}.ne-live-detection_camera_loading-text--show{display:flex}.ne-live-detection_camera_loading-bg{background-color:#161616;border-radius:50%;left:0;position:absolute;top:0;width:100%}.ne-live-detection_camera_loading-circle{animation:spin 2s linear infinite;border:4px solid transparent;border-radius:50%;border-top-color:#48dd69;bottom:0;content:"";left:0;position:absolute;right:0;top:0}.ne-live-detection_camera_loading-msg{color:#fff;font-size:14px;left:50%;letter-spacing:0;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%)}.ne-live-detection_camera_circle-bg{border:2px solid #eceef9;border-radius:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:30}.ne-live-detection_camera_circle-animation{border:2px solid transparent;border-radius:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:40}.ne-live-detection_progress{align-items:center;display:flex;flex-wrap:nowrap;justify-content:center;margin-top:60px}.ne-live-detection_progress_step{background:#dde3ef;border-radius:100%;font-size:0;height:10px;margin:0 8px;width:10px}.ne-live-detection_progress_step--active{align-items:center;background:#2b63ff;color:#fff;display:flex;font-size:12px;font-weight:600;height:20px;justify-content:center;width:20px}.ne-live-detection_footer{align-items:flex-start;display:flex;flex:1;justify-content:space-around;margin-top:60px;width:100%}.ne-live-detection_footer_icon-wrap{align-items:center;display:flex;flex:1;flex-direction:column;padding:0 4px}.ne-live-detection_footer_icon{height:32px;width:32px}.ne-live-detection_footer_text{color:#8a8a99;font-size:14px;margin:16px 0 0;text-align:center}.ne-live-detection_color{height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.ne-live-detection_color_circle{animation:scale .3s linear;animation-fill-mode:forwards;animation-play-state:paused;border-radius:50%;display:none;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%) scale(1)}.ne-live-detection_color_circle--active{animation-play-state:running;display:block}.ne-live-detection_record{background:#fff;bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:50}.ne-live-detection_record-checking,.ne-live-detection_record-fail,.ne-live-detection_record-start{align-items:center;display:flex;flex-direction:column;height:100%;width:100%}.ne-live-detection_record-tip-icon{height:140px;margin-top:50px;width:140px}.ne-live-detection_record-ani-wrapper{height:80px;margin:70px 0 32px;position:relative;text-align:center;width:80px}.ne-live-detection_record-tip-main{color:rgba(34,34,34,.85);font-size:26px;font-weight:600;line-height:46px}.ne-live-detection_record-tip-sub{color:rgba(34,34,34,.85);font-size:18px;line-height:32px;text-align:center}.ne-live-detection_record-tip-third{color:hsla(0,0%,40%,.85);font-size:18px;margin-top:16px;padding:0 60px;text-align:center}.ne-live-detection_record-condition-wrapper{box-sizing:border-box;margin-top:16px;padding:0 60px;width:100%}.ne-live-detection_record-condition-inner{margin-top:16px}.ne-live-detection_record-condition-icon{height:24px;margin-right:4px;vertical-align:middle;width:24px}.ne-live-detection_record-condition-text{color:#8a8a99;font-size:16px;line-height:1;vertical-align:middle}.ne-live-detection_record-btn-wrapper{box-sizing:border-box;margin-top:38px;padding:0 60px;position:relative;width:100%}.ne-live-detection_record-btn{background:linear-gradient(115deg,#60b1fe -38.66%,#6551f6 106.74%);border:none;border-radius:24px;box-sizing:border-box;color:#fff;font-size:18px;height:48px;outline:none;width:100%}.ne-live-detection_record-file-input{box-sizing:border-box;display:block;height:48px;margin-top:-48px;opacity:0;width:100%}.ne-live-detection_record-ani-scan{animation:scan 2s linear infinite;background:#5bdefe;box-shadow:0 4px 8px rgba(43,162,255,.56),0 18px 34px rgba(30,132,255,.732);height:4px;left:0;position:absolute;top:0;width:100%}.ne-live-detection_record-ani-img{height:100%}.ne-live-detection_toast{word-wrap:break-word;background:hsla(0,0%,8%,.6);background-color:rgba(0,0,0,.6);border-radius:2px;box-shadow:0 3px 6px -4px rgba(0,0,0,.122),0 6px 16px rgba(0,0,0,.078),0 9px 28px 8px rgba(0,0,0,.051);color:#fff;font-size:16px;padding:16px;position:absolute;text-align:left;text-decoration:none;white-space:nowrap}.ne-live-detection_toast_center{left:50%;top:284px;transform:translateX(-50%)}.ne-live-detection_toast_top{left:50%;top:20px;transform:translateX(-50%)}#ne-live-detection_camera_video{background-color:transparent}#ne-live-detection_camera_video::-webkit-media-controls-panel,#ne-live-detection_camera_video::-webkit-media-controls-play-button{-webkit-appearance:none;display:none!important}#ne-live-detection_camera_video::-webkit-media-controls-start-playback-button{-webkit-appearance:none;display:none!important}@keyframes scale{0%{transform:translate(-50%,-50%) scale(1)}to{transform:translate(-50%,-50%) scale(6)}}@keyframes scan{0%{top:0}to{top:100%}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}