Open
docs: upgrade master README to v0.4.2 template #31
fangzhenAdd on Sep 18
docs: upgrade master README to v0.4.2 template #31
Open
Total: 2 files changed+116-138
| @@ -1,17 +1,19 @@ | |||
| 1 | -> 文档模板:v0.4.1 | 1 | +> 文档模板:v0.4.2 |
| 2 | 2 | ||
| 3 | -# <center>react-native-create-thumbnail</center> | 3 | +<p align="center"> |
| 4 | + <h1 align="center"> <code>react-native-create-thumbnail</code> </h1> | ||
| 5 | +</p> | ||
| 4 | 6 | ||
| 5 | 本项目基于 [react-native-create-thumbnail](https://github.com/souvik-ghosh/react-native-create-thumbnail) 开发。 | 7 | 本项目基于 [react-native-create-thumbnail](https://github.com/souvik-ghosh/react-native-create-thumbnail) 开发。 |
| 6 | 8 | ||
| 7 | -该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-create-thumbnail` 版本所属关系如下: | 9 | +该第三方库的仓库已迁移至 GitCode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-create-thumbnail`,版本所属关系如下: |
| 8 | 10 | ||
| 9 | -| 三方库名称 | 三方库版本 | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | npm地址 | | 11 | +| 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 | |
| 10 | -| ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- | | 12 | +| --- | --- | --- | --- | --- | --- | --- | --- | |
| 11 | -| @react-native-ohos/react-native-create-thumbnail | [~ 2.2.0 (开发中)](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/master) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/releases) | 0.82.* | 是 | API12+ | 2.2.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | | 13 | +| @react-native-ohos/react-native-create-thumbnail | [~2.2.0(开发中)](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/releases) | 0.82.* | 是 | API12+ | 2.0.1 | [master](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/master) | |
| 12 | -| @react-native-ohos/react-native-create-thumbnail | [~ 2.1.0](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.77) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/releases) | 0.77.* | 否 | API12+ | 2.1.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | | 14 | +| @react-native-ohos/react-native-create-thumbnail | [~2.1.0](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/releases) | 0.77.* | 否 | API12+ | 2.0.1 | [br_rnoh0.77](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.77) | |
| 13 | -| @react-native-ohos/react-native-create-thumbnail | [~ 2.0.1](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.72) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/releases) | 0.72.* | 是 | API12+ | 2.0.1 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | | 15 | +| @react-native-ohos/react-native-create-thumbnail | [~2.0.1](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/releases) | 0.72.* | 是 | API12+ | 2.0.0 | [br_rnoh0.72](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.72) | |
| 14 | -| @react-native-oh-tpl/react-native-create-thumbnail | <= 2.0.0-0.0.4@deprecated | [GitHub Releases(deprecated)](https://github.com/react-native-oh-library/react-native-create-thumbnail/releases) | 0.72 | 否 | API12+ | 2.0.0 | [Npm Address](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-create-thumbnail) | | 16 | +| @react-native-oh-tpl/react-native-create-thumbnail | [<= 2.0.0-0.0.4@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-create-thumbnail) | [GitHub Releases(deprecated)](https://github.com/react-native-oh-library/react-native-create-thumbnail/releases) | 0.72.* | 否 | API12+ | 2.0.0 | [sig](https://github.com/react-native-oh-library/react-native-create-thumbnail) | |
| 15 | 17 | ||
| 16 | ## 简介 | 18 | ## 简介 |
| 17 | 19 | ||
| @@ -25,25 +27,24 @@ React Native 视频缩略图生成库。<br/> | |||
| 25 | **npm** | 27 | **npm** |
| 26 | 28 | ||
| 27 | ```bash | 29 | ```bash |
| 30 | +npm install react-native-create-thumbnail@2.0.1 | ||
| 28 | npm install @react-native-ohos/react-native-create-thumbnail | 31 | npm install @react-native-ohos/react-native-create-thumbnail |
| 29 | ``` | 32 | ``` |
| 30 | 33 | ||
| 31 | **yarn** | 34 | **yarn** |
| 32 | 35 | ||
| 33 | ```bash | 36 | ```bash |
| 37 | +yarn add react-native-create-thumbnail@2.0.1 | ||
| 34 | yarn add @react-native-ohos/react-native-create-thumbnail | 38 | yarn add @react-native-ohos/react-native-create-thumbnail |
| 35 | ``` | 39 | ``` |
| 36 | 40 | ||
| 37 | ## Link | 41 | ## Link |
| 38 | 42 | ||
| 39 | -| | 是否支持autolink | RN框架版本 | | 43 | +| 版本 | 是否支持autolink | RN框架版本 | |
| 40 | -|--------------------------------------|-----------------|------------| | 44 | +| --- | --- | --- | |
| 41 | -| ~ 2.2.0 | Yes | 0.82 | | 45 | +| ~2.2.0 | 是 | 0.82.* | |
| 42 | -| ~ 2.1.0 | No | 0.77 | | ||
| 43 | -| ~ 2.0.1 | Yes | 0.72 | | ||
| 44 | -| <= 2.0.0-0.0.4@deprecated | No | 0.72 | | ||
| 45 | 46 | ||
| 46 | -使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md | 47 | +使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/CPF-RN/ohos_react_native/blob/main/docs/zh-cn/02-开发/02-开发指南/Autolinking.md |
| 47 | 48 | ||
| 48 | 如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置。 | 49 | 如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置。 |
| 49 | <details> | 50 | <details> |
| @@ -60,7 +61,7 @@ yarn add @react-native-ohos/react-native-create-thumbnail | |||
| 60 | ```json | 61 | ```json |
| 61 | { | 62 | { |
| 62 | "overrides": { | 63 | "overrides": { |
| 63 | - "@rnoh/react-native-openharmony": "^0.77.73" // ohpm 在线版本 | 64 | + "@rnoh/react-native-openharmony": "~0.82.18" // ohpm 在线版本 |
| 64 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // 指向本地 har 包的路径 | 65 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // 指向本地 har 包的路径 |
| 65 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // 指向源码路径 | 66 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // 指向源码路径 |
| 66 | } | 67 | } |
| @@ -170,6 +171,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { | |||
| 170 | ]; | 171 | ]; |
| 171 | } | 172 | } |
| 172 | ``` | 173 | ``` |
| 174 | + | ||
| 173 | </details> | 175 | </details> |
| 174 | 176 | ||
| 175 | ### 运行 | 177 | ### 运行 |
| @@ -192,9 +194,6 @@ ohpm install | |||
| 192 | 本文档内容基于以下版本验证通过: | 194 | 本文档内容基于以下版本验证通过: |
| 193 | 195 | ||
| 194 | 1. RNOH: 0.82.7; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112 SP12; | 196 | 1. RNOH: 0.82.7; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112 SP12; |
| 195 | -2. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; | ||
| 196 | -3. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; | ||
| 197 | -4. RNOH: 0.77.73; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; | ||
| 198 | 197 | ||
| 199 | ### 权限要求 | 198 | ### 权限要求 |
| 200 | 199 | ||
| @@ -386,10 +385,10 @@ try { | |||
| 386 | | dirSize | number | no | 100 | iOS、Android | yes | 缓存目录最大大小(MB) | | 385 | | dirSize | number | no | 100 | iOS、Android | yes | 缓存目录最大大小(MB) | |
| 387 | | headers | object | no | — | iOS、Android | yes | 加载视频的请求头 | | 386 | | headers | object | no | — | iOS、Android | yes | 加载视频的请求头 | |
| 388 | | cacheName | string | no | — | iOS、Android | yes | 缩略图缓存名称 | | 387 | | cacheName | string | no | — | iOS、Android | yes | 缩略图缓存名称 | |
| 389 | -| maxWidth<sup>2.0.2+</sup> | number | no | 512 | iOS、Android | yes | 最大缩略图宽度(像素) | | 388 | +| maxWidth | number | no | 512 | iOS、Android | yes | 最大缩略图宽度(像素) | |
| 390 | -| maxHeight<sup>2.0.2+</sup> | number | no | 512 | iOS、Android | yes | 最大缩略图高度(像素) | | 389 | +| maxHeight | number | no | 512 | iOS、Android | yes | 最大缩略图高度(像素) | |
| 391 | -| timeToleranceMs<sup>2.0.2+</sup> | number | no | — | iOS | no | 时间容差(毫秒) | | 390 | +| timeToleranceMs | number | no | — | iOS | no | 时间容差(毫秒) | |
| 392 | -| onlySyncedFrames<sup>2.0.2+</sup> | boolean | no | — | Android | yes | 是否只使用同步帧 | | 391 | +| onlySyncedFrames | boolean | no | true | Android | yes | 是否只使用同步帧 | |
| 393 | 392 | ||
| 394 | ### 返回值 | 393 | ### 返回值 |
| 395 | 394 | ||
| @@ -400,14 +399,14 @@ try { | |||
| 400 | | mime | string | no | iOS、Android | yes | 缩略图 MIME 类型 | | 399 | | mime | string | no | iOS、Android | yes | 缩略图 MIME 类型 | |
| 401 | | width | number | no | iOS、Android | yes | 缩略图宽度 | | 400 | | width | number | no | iOS、Android | yes | 缩略图宽度 | |
| 402 | | height | number | no | iOS、Android | yes | 缩略图高度 | | 401 | | height | number | no | iOS、Android | yes | 缩略图高度 | |
| 403 | -| timeStamp | number | no | iOS、Android | yes | 缩略图时间戳(毫秒)🆕 | | 402 | +| timeStamp | number | no | — | yes | 缩略图时间戳(毫秒) | |
| 404 | -| onlySyncedFrames | boolean | no | Android | yes | 是否只使用同步帧 🆕 | | 403 | +| onlySyncedFrames | boolean | no | — | yes | 是否只使用同步帧 | |
| 405 | -| headers | object | no | iOS、Android | yes | 加载视频的请求头 🆕 | | 404 | +| headers | object | no | — | yes | 加载视频的请求头 | |
| 406 | -| dirSize | number | no | iOS、Android | yes | 缓存目录最大大小(MB) 🆕 | | 405 | +| dirSize | number | no | — | yes | 缓存目录最大大小(MB) | |
| 407 | 406 | ||
| 408 | ## 遗留问题 | 407 | ## 遗留问题 |
| 409 | 408 | ||
| 410 | -- [ ] timeToleranceMs 属性不支持,因为在 HarmonyOS 中没有提供对应的属性 [issues#1](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/issues/1) | 409 | +- timeToleranceMs 属性不支持,因为在 HarmonyOS 中没有提供对应的属性 [issues#1](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/issues/1) |
| 411 | 410 | ||
| 412 | ## 其他 | 411 | ## 其他 |
| 413 | 412 | ||
| @@ -416,34 +415,24 @@ try { | |||
| 416 | ## 目录结构 | 415 | ## 目录结构 |
| 417 | 416 | ||
| 418 | ```` | 417 | ```` |
| 419 | -/rntp_react-native-create-thumbnail # 项目根目录 | 418 | +/rntpc_react-native-create-thumbnail # 项目根目录 |
| 420 | -├── harmony # 适配代码 | 419 | +├── harmony # 鸿蒙适配代码 |
| 421 | -│ ├─ createThumbnail.har # har包 | 420 | +│ ├── createThumbnail.har # har 包 |
| 422 | -│ └─ createThumbnail # 适配核心代码 | 421 | +│ └── createThumbnail # 鸿蒙适配核心代码 |
| 423 | -│ ├─ Index.ets # 适配代码入口 | 422 | +│ ├── Index.ets # 鸿蒙适配代码入口 |
| 424 | -│ └─ src | 423 | +│ ├── ts.ets # TurboModule ArkTS 声明入口 |
| 425 | -│ ├─ main | 424 | +│ └── src/main |
| 426 | -│ │ ├─ cpp | 425 | +│ ├── cpp # C++ 适配代码 |
| 427 | -│ │ │ ├─ CMakeLists.txt | 426 | +│ ├── ets # ArkTS 适配代码(含 codegen 生成代码) |
| 428 | -│ │ │ ├─ CreateThumbnail.cpp | 427 | +│ └── module.json5 # 模块配置 |
| 429 | -│ │ │ ├─ CreateThumbnail.h | 428 | +├── src # RN 代码 |
| 430 | -│ │ │ └─ CreateThumbnailPackage.h | 429 | +│ └── NativeCreateThumbnail.ts # TurboModule Spec 定义 |
| 431 | -│ │ └─ ets | 430 | +├── example # 示例工程 |
| 432 | -│ │ ├─ CreateThumbnailPackage.ets # Package 注册 | 431 | +├── index.js # 入口文件 |
| 433 | -│ │ ├─ CreateThumbnailTurboModule.ts # TurboModule 实现 | 432 | +├── index.d.ts # 类型定义 |
| 434 | -│ │ ├─ download/RequestDownload.ts # 下载模块 | 433 | +├── README.md # 中文安装使用方法 |
| 435 | -│ │ └─ util | 434 | +├── README_en.md # 英文安装使用方法 |
| 436 | -│ │ ├─ FileUtil.ts | 435 | +└── package.json # 包配置 |
| 437 | -│ │ └─ StringUtil.ts | ||
| 438 | -│ └─ ohosTest # 测试代码 | ||
| 439 | -├── src | ||
| 440 | -│ ├─ index.js # 入口文件 | ||
| 441 | -│ ├─ index.d.ts # 类型定义 | ||
| 442 | -│ └─ NativeCreateThumbnail.ts # TurboModule Spec | ||
| 443 | -├── example # 示例工程 | ||
| 444 | -├── README.md # 中文安装使用方法 | ||
| 445 | -├── README_en.md # 英文安装使用方法 | ||
| 446 | -└─ package.json # 包配置 | ||
| 447 | ```` | 436 | ```` |
| 448 | 437 | ||
| 449 | ## 贡献代码 | 438 | ## 贡献代码 |
| @@ -452,4 +441,4 @@ try { | |||
| 452 | 441 | ||
| 453 | ## 开源协议 | 442 | ## 开源协议 |
| 454 | 443 | ||
| 455 | -本项目基于 [The MIT License (MIT)](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/blob/master/LICENSE) ,请自由地享受和参与开源。 | 444 | +本项目基于 [The MIT License (MIT)](https://github.com/souvik-ghosh/react-native-create-thumbnail/blob/master/LICENSE) ,请自由地享受和参与开源。 |
| @@ -1,17 +1,19 @@ | |||
| 1 | -> Document template: v0.4.1 | 1 | +> Document Template: v0.4.2 |
| 2 | 2 | ||
| 3 | -# <center>react-native-create-thumbnail</center> | 3 | +<p align="center"> |
| 4 | + <h1 align="center"> <code>react-native-create-thumbnail</code> </h1> | ||
| 5 | +</p> | ||
| 4 | 6 | ||
| 5 | This project is based on [react-native-create-thumbnail](https://github.com/souvik-ghosh/react-native-create-thumbnail). | 7 | This project is based on [react-native-create-thumbnail](https://github.com/souvik-ghosh/react-native-create-thumbnail). |
| 6 | 8 | ||
| 7 | -This third-party library has been migrated to Gitcode and is now available for direct download from npm. The new package name is: `@react-native-ohos/react-native-create-thumbnail`. The version correspondence details are as follows: | 9 | +This third-party library has been migrated to GitCode and is now available for direct download from npm. The new package name is: `@react-native-ohos/react-native-create-thumbnail`. The version correspondence details are as follows: |
| 8 | 10 | ||
| 9 | -| Name | Version | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | npm Address | | 11 | +| Name | Version(Npm Address) | Release Information | Supported RN Version | Supported Autolink | Compile API Version | Community Baseline Version | Source code address | |
| 10 | -| ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- | | 12 | +| --- | --- | --- | --- | --- | --- | --- | --- | |
| 11 | -| @react-native-ohos/react-native-create-thumbnail | [~ 2.2.0 (In development)](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/master) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/releases) | 0.82.* | Yes | API12+ | 2.2.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | | 13 | +| @react-native-ohos/react-native-create-thumbnail | [~2.2.0 (In development)](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/releases) | 0.82.* | Yes | API12+ | 2.0.1 | [master](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/master) | |
| 12 | -| @react-native-ohos/react-native-create-thumbnail | [~ 2.1.0](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.77) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/releases) | 0.77.* | No | API12+ | 2.1.0 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | | 14 | +| @react-native-ohos/react-native-create-thumbnail | [~2.1.0](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/releases) | 0.77.* | No | API12+ | 2.0.1 | [br_rnoh0.77](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.77) | |
| 13 | -| @react-native-ohos/react-native-create-thumbnail | [~ 2.0.1](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.72) | [Gitcode Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/releases) | 0.72.* | Yes | API12+ | 2.0.1 | [Npm Address](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | | 15 | +| @react-native-ohos/react-native-create-thumbnail | [~2.0.1](https://www.npmjs.com/package/@react-native-ohos/react-native-create-thumbnail) | [GitCode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/releases) | 0.72.* | Yes | API12+ | 2.0.0 | [br_rnoh0.72](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/tree/br_rnoh0.72) | |
| 14 | -| @react-native-oh-tpl/react-native-create-thumbnail | <= 2.0.0-0.0.4@deprecated | [GitHub Releases(deprecated)](https://github.com/react-native-oh-library/react-native-create-thumbnail/releases) | 0.72 | No | API12+ | 2.0.0 | [Npm Address](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-create-thumbnail) | | 16 | +| @react-native-oh-tpl/react-native-create-thumbnail | [<= 2.0.0-0.0.4@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-create-thumbnail) | [GitHub Releases(deprecated)](https://github.com/react-native-oh-library/react-native-create-thumbnail/releases) | 0.72.* | No | API12+ | 2.0.0 | [sig](https://github.com/react-native-oh-library/react-native-create-thumbnail) | |
| 15 | 17 | ||
| 16 | ## Introduction | 18 | ## Introduction |
| 17 | 19 | ||
| @@ -20,30 +22,29 @@ Implemented with HarmonyOS media capabilities, supporting both local and remote | |||
| 20 | 22 | ||
| 21 | ## Installation | 23 | ## Installation |
| 22 | 24 | ||
| 23 | -Go to the project directory and run: | 25 | +Go to the project directory and execute the following instruction: |
| 24 | 26 | ||
| 25 | **npm** | 27 | **npm** |
| 26 | 28 | ||
| 27 | ```bash | 29 | ```bash |
| 30 | +npm install react-native-create-thumbnail@2.0.1 | ||
| 28 | npm install @react-native-ohos/react-native-create-thumbnail | 31 | npm install @react-native-ohos/react-native-create-thumbnail |
| 29 | ``` | 32 | ``` |
| 30 | 33 | ||
| 31 | **yarn** | 34 | **yarn** |
| 32 | 35 | ||
| 33 | ```bash | 36 | ```bash |
| 37 | +yarn add react-native-create-thumbnail@2.0.1 | ||
| 34 | yarn add @react-native-ohos/react-native-create-thumbnail | 38 | yarn add @react-native-ohos/react-native-create-thumbnail |
| 35 | ``` | 39 | ``` |
| 36 | 40 | ||
| 37 | ## Link | 41 | ## Link |
| 38 | 42 | ||
| 39 | -| | Supported Autolink | Supported RN Version | | 43 | +| Version | Supported Autolink | Supported RN Version | |
| 40 | -|--------------------------------------|--------------------|----------------------| | 44 | +| --- | --- | --- | |
| 41 | -| ~ 2.2.0 | Yes | 0.82 | | 45 | +| ~2.2.0 | Yes | 0.82.* | |
| 42 | -| ~ 2.1.0 | No | 0.77 | | ||
| 43 | -| ~ 2.0.1 | Yes | 0.72 | | ||
| 44 | -| <= 2.0.0-0.0.4@deprecated | No | 0.72 | | ||
| 45 | 46 | ||
| 46 | -Projects using AutoLink need to be configured according to this document. AutoLink framework guide: https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md | 47 | +Projects using AutoLink need to be configured according to this document. AutoLink framework guide: https://gitcode.com/CPF-RN/ohos_react_native/blob/main/docs/en/02-development/02-development-guide/autolinking.md |
| 47 | 48 | ||
| 48 | If the version you are using supports Autolink and the project has integrated Autolink, you can skip the ManualLink configuration. | 49 | If the version you are using supports Autolink and the project has integrated Autolink, you can skip the ManualLink configuration. |
| 49 | <details> | 50 | <details> |
| @@ -60,7 +61,7 @@ For more information about this field, see the [official documentation](https:// | |||
| 60 | ```json | 61 | ```json |
| 61 | { | 62 | { |
| 62 | "overrides": { | 63 | "overrides": { |
| 63 | - "@rnoh/react-native-openharmony": "^0.77.73" // ohpm version | 64 | + "@rnoh/react-native-openharmony": "~0.82.18" // ohpm version |
| 64 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // a locally available HAR package | 65 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // a locally available HAR package |
| 65 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // source code directory | 66 | // "@rnoh/react-native-openharmony" : "./react_native_openharmony" // source code directory |
| 66 | } | 67 | } |
| @@ -170,6 +171,7 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { | |||
| 170 | ]; | 171 | ]; |
| 171 | } | 172 | } |
| 172 | ``` | 173 | ``` |
| 174 | + | ||
| 173 | </details> | 175 | </details> |
| 174 | 176 | ||
| 175 | ### Running | 177 | ### Running |
| @@ -192,9 +194,6 @@ Then build and run the project. | |||
| 192 | The content of this document has been verified based on the following versions: | 194 | The content of this document has been verified based on the following versions: |
| 193 | 195 | ||
| 194 | 1. RNOH: 0.82.7; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112 SP12; | 196 | 1. RNOH: 0.82.7; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112 SP12; |
| 195 | -2. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; | ||
| 196 | -3. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71; | ||
| 197 | -4. RNOH: 0.77.73; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112; | ||
| 198 | 197 | ||
| 199 | ### Permission Requirements | 198 | ### Permission Requirements |
| 200 | 199 | ||
| @@ -310,7 +309,7 @@ const styles = StyleSheet.create({ | |||
| 310 | }); | 309 | }); |
| 311 | ``` | 310 | ``` |
| 312 | 311 | ||
| 313 | -## Usage Guide | 312 | +## How to Use |
| 314 | 313 | ||
| 315 | **Generate Thumbnail** | 314 | **Generate Thumbnail** |
| 316 | 315 | ||
| @@ -364,92 +363,82 @@ try { | |||
| 364 | } | 363 | } |
| 365 | ``` | 364 | ``` |
| 366 | 365 | ||
| 367 | -## API Reference | 366 | +## Available APIs |
| 368 | 367 | ||
| 369 | > [!TIP] The **Platform** column indicates the platforms supported by the original third-party library. | 368 | > [!TIP] The **Platform** column indicates the platforms supported by the original third-party library. |
| 370 | 369 | ||
| 371 | -> [!TIP] If **OpenHarmony Support** is **yes**, the OpenHarmony platform supports this API; **no** means not supported; **partially** means partially supported. Usage is consistent across platforms, and the effect aligns with iOS or Android. | 370 | +> [!TIP] If **OpenHarmony Platform Support** is **yes**, the OpenHarmony platform supports this property; **no** means not supported; **partially** means partially supported. Usage is consistent across platforms, and the effect aligns with iOS or Android. |
| 372 | 371 | ||
| 373 | ### API | 372 | ### API |
| 374 | 373 | ||
| 375 | -| Name | Type | Parameter Type | Return Value | Required | Platform | OpenHarmony Support | Description | | 374 | +| Name | Type | Parameter Type | Return Value | Required | Platform | OpenHarmony Platform Support | Description | |
| 376 | -|------|------|----------------|--------------|----------|----------|---------------------|-------------| | 375 | +|------|------|----------------|--------------|----------|----------|------------------------------|-------------| |
| 377 | -| createThumbnail | function | Config | Promise<Thumbnail> | No | iOS、Android | yes | Generate video thumbnail | | 376 | +| createThumbnail | function | Config | Promise<Thumbnail> | No | iOS, Android | yes | Generate video thumbnail | |
| 378 | 377 | ||
| 379 | ### Parameters | 378 | ### Parameters |
| 380 | 379 | ||
| 381 | -| Name | Type | Required | Default | Platform | OpenHarmony Support | Description | | 380 | +| Name | Type | Required | Default | Platform | OpenHarmony Platform Support | Description | |
| 382 | |------|------|----------|---------|----------|---------------------|-------------| | 381 | |------|------|----------|---------|----------|---------------------|-------------| |
| 383 | -| url | string | yes | — | iOS、Android | yes | Path to video file (local or remote) | | 382 | +| url | string | yes | — | iOS, Android | yes | Path to video file (local or remote) | |
| 384 | -| timeStamp | number | no | 0 | iOS、Android | yes | Thumbnail timestamp (in milliseconds) | | 383 | +| timeStamp | number | no | 0 | iOS, Android | yes | Thumbnail timestamp (in milliseconds) | |
| 385 | -| format | "jpeg" \| "png" | no | "jpeg" | iOS、Android | yes | Thumbnail format | | 384 | +| format | "jpeg" \| "png" | no | "jpeg" | iOS, Android | yes | Thumbnail format | |
| 386 | -| dirSize | number | no | 100 | iOS、Android | yes | Maximum cache directory size (MB) | | 385 | +| dirSize | number | no | 100 | iOS, Android | yes | Maximum cache directory size (MB) | |
| 387 | -| headers | object | no | — | iOS、Android | yes | Headers to load the video with | | 386 | +| headers | object | no | — | iOS, Android | yes | Headers to load the video with | |
| 388 | -| cacheName | string | no | — | iOS、Android | yes | Cache name for the thumbnail | | 387 | +| cacheName | string | no | — | iOS, Android | yes | Cache name for the thumbnail | |
| 389 | -| maxWidth<sup>2.0.2+</sup> | number | no | 512 | iOS、Android | yes | Maximum thumbnail width (pixels) | | 388 | +| maxWidth | number | no | 512 | iOS, Android | yes | Maximum thumbnail width (pixels) | |
| 390 | -| maxHeight<sup>2.0.2+</sup> | number | no | 512 | iOS、Android | yes | Maximum thumbnail height (pixels) | | 389 | +| maxHeight | number | no | 512 | iOS, Android | yes | Maximum thumbnail height (pixels) | |
| 391 | -| timeToleranceMs<sup>2.0.2+</sup> | number | no | — | iOS | no | Time tolerance (in milliseconds) | | 390 | +| timeToleranceMs | number | no | — | iOS | no | Time tolerance (in milliseconds) | |
| 392 | -| onlySyncedFrames<sup>2.0.2+</sup> | boolean | no | — | Android | yes | Whether to use only sync frames | | 391 | +| onlySyncedFrames | boolean | no | true | Android | yes | Whether to use only sync frames | |
| 393 | 392 | ||
| 394 | ### Return Value | 393 | ### Return Value |
| 395 | 394 | ||
| 396 | -| Name | Type | Required | Platform | OpenHarmony Support | Description | | 395 | +| Name | Type | Required | Platform | OpenHarmony Platform Support | Description | |
| 397 | |------|------|----------|----------|---------------------|-------------| | 396 | |------|------|----------|----------|---------------------|-------------| |
| 398 | -| path | string | no | iOS、Android | yes | Path to generated thumbnail | | 397 | +| path | string | no | iOS, Android | yes | Path to generated thumbnail | |
| 399 | -| size | number | no | iOS、Android | yes | Thumbnail size (in bytes) | | 398 | +| size | number | no | iOS, Android | yes | Thumbnail size (in bytes) | |
| 400 | -| mime | string | no | iOS、Android | yes | Thumbnail MIME type | | 399 | +| mime | string | no | iOS, Android | yes | Thumbnail MIME type | |
| 401 | -| width | number | no | iOS、Android | yes | Thumbnail width | | 400 | +| width | number | no | iOS, Android | yes | Thumbnail width | |
| 402 | -| height | number | no | iOS、Android | yes | Thumbnail height | | 401 | +| height | number | no | iOS, Android | yes | Thumbnail height | |
| 403 | -| timeStamp | number | no | iOS、Android | yes | Thumbnail timestamp (in milliseconds) 🆕 | | 402 | +| timeStamp | number | no | — | yes | Thumbnail timestamp (in milliseconds) | |
| 404 | -| onlySyncedFrames | boolean | no | Android | yes | Whether to use only sync frames 🆕 | | 403 | +| onlySyncedFrames | boolean | no | — | yes | Whether to use only sync frames | |
| 405 | -| headers | object | no | iOS、Android | yes | Headers to load the video with 🆕 | | 404 | +| headers | object | no | — | yes | Headers to load the video with | |
| 406 | -| dirSize | number | no | iOS、Android | yes | Maximum cache directory size (MB) 🆕 | | 405 | +| dirSize | number | no | — | yes | Maximum cache directory size (MB) | |
| 407 | 406 | ||
| 408 | ## Known Issues | 407 | ## Known Issues |
| 409 | 408 | ||
| 410 | -- [ ] timeToleranceMs property is not supported because there is no corresponding property in HarmonyOS [issues#1](https://gitcode.com/openharmony-sig/rntpc_react-native-create-thumbnail/issues/1) | 409 | +- timeToleranceMs property is not supported because there is no corresponding property in HarmonyOS [issues#1](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/issues/1) |
| 411 | 410 | ||
| 412 | -## Others | 411 | +## Other |
| 413 | 412 | ||
| 414 | None | 413 | None |
| 415 | 414 | ||
| 416 | ## Directory Structure | 415 | ## Directory Structure |
| 417 | 416 | ||
| 418 | ```` | 417 | ```` |
| 419 | -/rntp_react-native-create-thumbnail | 418 | +/rntpc_react-native-create-thumbnail # Project root directory |
| 420 | -├── harmony # adaptation code | 419 | +├── harmony # HarmonyOS adaptation code |
| 421 | -│ ├─ createThumbnail.har # HAR package | 420 | +│ ├── createThumbnail.har # HAR package |
| 422 | -│ └─ createThumbnail # Core adaptation code | 421 | +│ └── createThumbnail # Core adaptation code |
| 423 | -│ ├─ Index.ets # Adaptation entry | 422 | +│ ├── Index.ets # Adaptation code entry |
| 424 | -│ └─ src | 423 | +│ ├── ts.ets # TurboModule ArkTS declaration entry |
| 425 | -│ ├─ main | 424 | +│ └── src/main |
| 426 | -│ │ ├─ cpp | 425 | +│ ├── cpp # C++ adaptation code |
| 427 | -│ │ │ ├─ CMakeLists.txt | 426 | +│ ├── ets # ArkTS adaptation code (including codegen-generated code) |
| 428 | -│ │ │ ├─ CreateThumbnail.cpp | 427 | +│ └── module.json5 # Module configuration |
| 429 | -│ │ │ ├─ CreateThumbnail.h | 428 | +├── src # React Native code |
| 430 | -│ │ │ └─ CreateThumbnailPackage.h | 429 | +│ └── NativeCreateThumbnail.ts # TurboModule Spec definition |
| 431 | -│ │ └─ ets | 430 | +├── example # Example project |
| 432 | -│ │ ├─ CreateThumbnailPackage.ets # Package registration | 431 | +├── index.js # Entry file |
| 433 | -│ │ ├─ CreateThumbnailTurboModule.ts # TurboModule implementation | 432 | +├── index.d.ts # Type definitions |
| 434 | -│ │ ├─ download/RequestDownload.ts # Download module | 433 | +├── README.md # Chinese installation and usage guide |
| 435 | -│ │ └─ util | 434 | +├── README_en.md # English installation and usage guide |
| 436 | -│ │ ├─ FileUtil.ts | 435 | +└── package.json # Package configuration |
| 437 | -│ │ └─ StringUtil.ts | ||
| 438 | -│ └─ ohosTest # Test code | ||
| 439 | -├── src | ||
| 440 | -│ ├─ index.js # Entry file | ||
| 441 | -│ ├─ index.d.ts # Type definitions | ||
| 442 | -│ └─ NativeCreateThumbnail.ts # TurboModule Spec | ||
| 443 | -├── example # Example project | ||
| 444 | -├── README.md # Chinese installation and usage guide | ||
| 445 | -├── README_en.md # English installation and usage guide | ||
| 446 | -└─ package.json # Package configuration | ||
| 447 | ```` | 436 | ```` |
| 448 | 437 | ||
| 449 | -## Contributing | 438 | +## How to Contribute |
| 450 | 439 | ||
| 451 | If you find any issues during usage, feel free to submit an [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/issues). Pull requests are also welcome: [PR](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/pulls). | 440 | If you find any issues during usage, feel free to submit an [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/issues). Pull requests are also welcome: [PR](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/pulls). |
| 452 | 441 | ||
| 453 | ## License | 442 | ## License |
| 454 | 443 | ||
| 455 | -This project is licensed under [The MIT License (MIT)](https://gitcode.com/CPF-RN/rntpc_react-native-create-thumbnail/blob/master/LICENSE). | 444 | +This project is licensed under [The MIT License (MIT)](https://github.com/souvik-ghosh/react-native-create-thumbnail/blob/master/LICENSE). |