更新记录

1.0.3(2026-10-31) 下载此版本

  • 将 DCloud 市场主说明、插件描述和示例说明统一为中文。
  • 补充中文快速开始示例,以及真实 iOS/Android 真机验收状态。

1.0.2(2026-10-31) 下载此版本

  • Add static preload and setP2pEnabled helpers for Vue/JavaScript callers.
  • Add numeric event subscriptions for Vue/JavaScript and use them in the demo so cleanup does not depend on a returned UTS function.
  • Add a JavaScript Promise adapter with explicit UTS result callbacks so native errors reach page catch handlers on HBuilderX 5.33.
  • Fix the Android UTS Maven repository to use the canonical public endpoint.
  • Restrict the SDK group to its public Maven repository and document the HBuilderX 5.33 repository workaround.
  • Fix iOS UTS event unsubscription by comparing subscription IDs instead of callback functions.
  • Add DCloud permissions, data collection, advertising, and platform declarations.
  • Record pending iOS runtime acceptance before market publication.

平台兼容性

uni-app(3.0.0)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- √ - - √ - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - - -

MeshStream P2P Uniapp SDK

当前版本:1.0.3。1.0.2 已发布到 DCloud 插件市场;本版本将市场主说明、插件描述和变更记录统一为中文。

运行要求

  • HBuilderX 4.25+、uni-app Vue 3 App;当前候选验证使用 HBuilderX 5.33。
  • Android 7.0 / API 24+;iOS 15+。
  • Android 公开依赖:io.meshstream:meshstream-android-sdk:1.0.6,Maven 地址 https://sdk.meshstream.net/maven。
  • iOS 公开依赖:CocoaPods MeshStreamKit = 1.0.7。两个平台 native 运行时版本返回 1.0.6,与 Apple 分发版本不同是预期行为。
  • 使用自定义基座或云打包;标准基座无法包含本插件所需的原生 SDK 和配置。

安装与接入

将插件 ZIP 内的文件解压到应用的 uni_modules/meshstream-p2p/,确保 package.json 直接位于该目录下。不要将仓库的 example/、发行记录或编译缓存复制到模块内。

Vue/JavaScript 页面请使用 import { MeshStream } from '@/uni_modules/meshstream-p2p/javascript.js'。此入口在 JavaScript 中管理 Promise,通过 UTS 明确回传成功或错误,避免 HBuilderX 5.33 原生异步拒绝无法传回页面而卡住。UTS 调用方仍可导入模块根目录。

快速开始

使用 MeshStream 静态 API 创建客户端和播放会话。播放器使用 session.playbackUrl,源媒体地址应使用 HTTPS:

import { MeshStream } from '@/uni_modules/meshstream-p2p/javascript.js'

const client = await MeshStream.create({
  key: 'key_你的 MeshStream Key',
  p2pEnabled: true,
})
const session = await MeshStream.createPlaybackSession(client.clientId, {
  url: 'https://cdn.example.com/live/playlist.m3u8',
  contentId: 'live-channel-42',
  mimeType: 'm3u8',
})

// 将 session.playbackUrl 绑定到现有 video 播放器。
const eventId = MeshStream.subscribeEvents((event) => {
  const type = event.getString ? event.getString('type') : event.type
  console.log('MeshStream 事件:', type)
})

await MeshStream.updateCurrentPositionMs(client.clientId, session.sessionId, positionMs)
await MeshStream.updateBufferedDurationMs(client.clientId, session.sessionId, bufferedDurationMs)

MeshStream.unsubscribeEvents(eventId)
await MeshStream.closeSession(client.clientId, session.sessionId)
await MeshStream.closeClient(client.clientId)

Vue/JavaScript 页面不要直接调用返回对象上的实例方法。预加载使用 await MeshStream.preload(client.clientId, session.sessionId),切换 P2P 使用 await MeshStream.setP2pEnabled(client.clientId, session.sessionId, enabled)。

事件使用 const id = MeshStream.subscribeEvents(callback) 注册,再用 MeshStream.unsubscribeEvents(id) 取消。JavaScript 入口也支持 addEventListener 返回本地取消函数;旧的 UTS 入口返回函数无法可靠跨越 Vue/JavaScript 边界。

当前验收状态

Android/iOS UTS 编译已通过。Uniapp iOS 已在真实 iPhone 上完成播放验收,确认本地代理、P2P 统计和 CDN 回退链路可用;Android 也已完成真机播放和 P2P 验收。HBuilderX 5.33 自带的 Uniapp 模拟器基座只有 x86_64,Apple Silicon 模拟器不能直接使用该基座,因此 iOS 模拟器验收仍需 arm64 自定义基座。

Android 仓库解析

HBuilderX 5.33 临时 Gradle 工程使用 PREFER_SETTINGS,会忽略插件配置里的 Maven 仓库。若提示找不到 SDK,可按英文 README 配置 scripts/hbuilderx-gradle.sh 和实际 Gradle 可执行文件,仅对 HBuilderX 临时依赖解析工程启用 PREFER_PROJECT。不需要拷贝本地 AAR,也不要修改已发布的原生 SDK。

网络与隐私

SDK Key 校验、配置获取、tracker 和用量上报会处理应用标识、设备平台、IP/网络连接信息、内容及分片标识、上下行流量和诊断数据。接入方应告知用户 P2P 会使用上行网络流量。不读取相机、麦克风、通讯录或精确定位,无广告。HTTP 明文访问仅对本机代理 127.0.0.1 / localhost 开放。

隐私、权限声明

1. 本插件需要申请的系统权限列表:

Android:INTERNET / ACCESS_NETWORK_STATE 网络访问;iOS:本地网络访问(用于媒体分片交换)。不访问相机、麦克风、通讯录或定位。

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

MeshStream SDK 连接服务端进行 SDK Key 校验、配置获取、tracker 信令和用量统计,会处理应用标识、设备平台、IP/网络连接信息、内容及分片标识、下载/上传字节与诊断数据;不采集相机、麦克风、通讯录或精确定位数据。接入方需向用户说明 P2P 会使用网络和上行流量。

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

无广告

许可协议

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

  1. Definitions.

"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.

"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.

  1. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.

  2. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.

  3. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:

    (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and

    (b) You must cause any modified files to carry prominent notices stating that You changed the files; and

    (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and

    (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.

    You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.

  4. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.

  5. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.

  6. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.

  7. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.

  8. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

暂无用户评论。