Share a video to WeChat
Note:
- This API is only applicable to multi-platform applications and is not supported within Mini Program
- This API cannot be debugged in the "Mobile App Assistant". Developers must build an APK or IPA package and install it on a mobile device to debug
- This API is now supported on the HarmonyOS platform
Pre-Integration Notes
- This feature relies on the WeChat Open SDK. You must create a mobile app account on the WeChat Open Platform following the guidelines to complete the relevant initialization configurations. For details, refer to the WeChat Mobile App Capability Initialization Guide.
Parameters
To facilitate developer understanding, the parameters of wx.miniapp.shareVideoMessage are consistent with the WeChat Open Platform Open SDK share interface parameters.
| Attribute | Type | Default Value | Required | Description |
|---|---|---|---|---|
| videoUrl | string | - | Yes | Video link URL, length limit not exceeding 10KB |
| videoLowBandUrl | string | - | No | Video link URL for low-bandwidth environments, length limit not exceeding 10KB |
| title | string | - | Yes | Video title |
| description | string | - | Yes | Video description |
| thumbPath | string | - | Yes | Share thumbnail, supports code package image resource paths or local temporary, cache, and user files; network image paths are not supported |
| scene | number | - | No | Scene value |
| success | function | No | Success callback after retrieval | |
| fail | function | No | Failure callback after retrieval |
Note:
videoUrlandvideoLowBandUrlcannot both be empty.
Invocation Example
wx.miniapp.shareVideoMessage({
videoUrl: 'https://encrypted-vtbn0.gstatic.com/video?q=tbn:ANd9GcQPt0qbJ-TMyXt_fKgwfjE4y2qqS543MIWjjQ',
videoLowBandUrl: 'https://encrypted-vtbn0.gstatic.com/video?q=tbn:ANd9GcQPt0qbJ-TMyXt_fKgwfjE4y2qqS543MIWjjQ',
title: 'title',
description: 'description',
thumbPath: '/pages/thumb.png',
success(e) {
console.log(`share video success: ${JSON.stringify(e)})`)
},
fail(e) {
console.log(`share video failed: ${JSON.stringify(e)}`)
}
})