Uniapp SDK installation and setup
The current DCloud plugin is meshstream-p2p 1.0.6, available from the DCloud plugin market. It targets uni-app Vue 3 App and does not provide a player or decoder.
Before you start
- HBuilderX 4.25+;
- an SDK Key created for the uni-app application in the console;
- a playable HLS
.m3u8, DASH.mpd, or an MP4/MP3 URL with Range support; - a uni-app player that supports the target format;
- an Android or iOS custom base or cloud packaging environment.
The plugin declares Android API 21 and iOS 15.0 as lower bounds. The application must satisfy the highest requirement from the plugin, HBuilderX base, player, and other dependencies; the current example uses Android API 24. The plugin pins the public Android SDK io.meshstream:meshstream-android-sdk:1.0.9 and iOS MeshStreamKit 1.0.8.
The Android dependency includes armeabi-v7a, arm64-v8a, x86, and x86_64. Devices and emulators must also meet the OS and architecture requirements of your framework, HBuilderX base, and player.
Install
See native project configuration for Android permissions and compilation requirements, and shrinking and memory for R8 and cache budgets. Retain the Java/Kotlin targets required by your HBuilderX base.
Install exact version 1.0.6 from HBuilderX's plugin market, or extract the released plugin package under uni_modules/meshstream-p2p/ with its package.json directly in that directory.
The standard base does not include the native SDK required by this plugin. Use a custom base or cloud packaging and make sure Android Maven and iOS CocoaPods can resolve the public native dependencies.
Platform network configuration
The SDK playback URL uses an HTTP loopback proxy. The player needs access to this proxy even when the original media source uses HTTPS.
Android
The plugin includes an Android Manifest and a loopback network policy. Retain its utssdk/app-android/AndroidManifest.xml and res/xml/ resources. If the host application has its own network configuration, merge the loopback rules into the policy that takes effect in the final application.
To manage the policy at application level, create nativeResources/android/res/xml/meshstream_app_network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">127.0.0.1</domain>
<domain includeSubdomains="false">localhost</domain>
</domain-config>
</network-security-config>
Create or merge AndroidManifest.xml at the application project root. Replace com.example.app with the Android package name used for cloud packaging:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app">
<application
android:networkSecurityConfig="@xml/meshstream_app_network_security_config"
tools:replace="android:networkSecurityConfig" />
</manifest>
Retain business domain rules in an existing policy. Public HTTP media origins require their own rules; prefer HTTPS. These per-domain rules apply to API 24+; for API 23, see the Android network configuration. See DCloud Android native configuration for file merging details.
iOS
Create or merge Info.plist at the application project root and allow local networking in ATS:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
</dict>
</plist>
If an ATS dictionary already exists, merge this key and retain its other restrictions. See DCloud iOS native configuration for file placement and merging.
After changing Android or iOS native network settings, rebuild the custom base or cloud package and reinstall it. Page hot updates do not change these settings.
Next step
After completing the setup above, continue to Quick integration to create a session, connect your player, and release playback resources.