May 18, 2021 WeChat Mini Program Development Document
Base library 1.7.0 starts to support, and low versions need to be compatible.
Live audio and video playback (v2.9.1 supports same-layer rendering).
Temporarily only for domestic subjects for the following types of purposes of small programs open, need to first pass the category audit, and then in the small program management background, "development" - "interface settings" in the self-service to open the component permissions.
Level 1 class/body type | Secondary class | Small program content scene |
---|---|---|
Social | Live | Involved in the nature of entertainment, such as live star, live life anecdotes, pet live, etc. The first submitted code review after selecting this category is subject to review and confirmation by the local Internet authority and is expected to take about 7 days |
Education | Online video courses | Online classes, online training, lectures and other educational live broadcasts |
Medical | Internet hospitals, public medical institutions, private medical institutions | Live coverage of consultations, large-scale health talks, etc |
Financial | Banking, trusts, public funds, private equity funds, securities/futures, securities, futures investment consulting, insurance, credit business, the new three-board information service platform, stock information service platform (Hong Kong stock/ U.S. stock), consumer finance | Financial products video customer service claims, financial products promotion live, etc |
Car | Car pre-sale service | Car pre-sale, promotion of live broadcast |
The main government account number | / | Government-related work to promote live broadcast, leadership speech live, etc |
Tools | Video customer service | One-to-one video customer service that does not involve the above categories of content, such as after-sales one-to-one video service |
IT Technology | Multi-communication | Provide multi-party conference calls / video conferencing |
Attributes | type | Defaults | Required | illustrate | Minimum version |
---|---|---|---|---|---|
src | string | no |
Audio video address.Currently only support
flv
,
rtmp
Format
|
1.7.0 | |
mode | string | live | no | model | 1.7.0 |
autoplay | boolean | false | no | Autoplay | 1.7.0 |
muted | boolean | false | no | Is it mute? | 1.7.0 |
orientation | string | vertical | no | Picture direction | 1.7.0 |
object-fit | string | contain | no |
Fill mode, optional value
contain
,
fillCrop
|
1.7.0 |
background-mute | boolean | false | no | Whether it is muted when entering the background (abandoned, the default retreat is mute) | 1.7.0 |
min-cache | number | 1 | no | Minimum buffer, unit S (RTC mode recommended 0.2s) | 1.7.0 |
max-cache | number | 3 | no | Maximum buffer, unit S (RTC mode recommended 0.8s).The buffer is used to resist network fluctuations, the more buffer data, the better the network resistance, but the time extension is large. | 1.7.0 |
sound-mode | string | speaker | no | Sound output method | 1.9.90 |
auto-pause-if-navigate | boolean | true | Whether | When you jump to another page of this small program, do you automatically pause live audio and video playback on this page? | 2.5.0 |
auto-pause-if-open-native | boolean | true | Whether | When you jump to another WeChat native page, do you automatically pause live audio and video playback on this page? | 2.5.0 |
picture-in-picture-mode | string/Array | Whether | Set small window mode: push, pop, empty string or set multiple modes in array form (e.g.: "push", "pop") | 2.10.3 | |
bindstatechange | eventhandle | Whether | Play State Change Events, Details . | 1.7.0 | |
bindfullscreenchange | eventhandle | Whether | Full-screen change events, details s. | 1.7.0 | |
bindnetstatus | eventhandle | Whether | Network status notifications, detail . | 1.9.0 | |
bindaudiovolumenotify | eventhandler | Whether | Play volume-size notifications, details . . . | 2.10.0 | |
bindenterpictureinpicture | eventhandler | Whether | The player enters the window | 2.11.0 | |
bindleavepictureinpicture | eventhandler | Whether | The player exits the window | 2.11.0 |
The legal value of mode
Value | Description | The lowest version |
---|---|---|
live | Live | |
Rtc | Real-time calls, with lower latency in this mode |
The legal value of orientation
Value | Description | The lowest version |
---|---|---|
vertical | Vertical | |
horizontal | Level |
The legal value of object-fit
Value | Description | The lowest version |
---|---|---|
contain | The long side of the image fills the screen, and the short edge area is filled with tinge | |
fillCrop | The image is spread across the screen and the part beyond the display area is cut off |
The legal value of sound-mode
Value | Description | The lowest version |
---|---|---|
speaker | Speaker | |
ear | Receiver |
The legal value of picture-in-picture-mode
Value | Description | The lowest version |
---|---|---|
[] | Cancel the small window | |
push | The window is triggered when the push is routed | |
pop | The window is triggered when the pop is routed |
Code | Description |
---|---|
2001 | The server is already connected |
2002 | The RTMP server is connected and the pull stream begins |
2003 | The network receives the first video packet (IDR) |
2004 | Video playback begins |
2005 | The progress of the video playback |
2006 | The video playback ends |
2007 | The video plays Loading |
2008 | The decoder starts |
2009 | The video resolution changes |
-2301 | The network is disconnected, and after multiple re-link rescue is invalid, more retry please restart playback |
-2302 | Failed to get the accelerated pull address |
2101 | The current video frame decoding failed |
2102 | The current audio frame decoding failed |
2103 | The network is disconnected and an automatic reconneconne is started |
2104 | Network packet instability: Perhaps due to insufficient downstream bandwidth, or due to uneven host outflow |
2105 | Caton appears in the current video playback |
2106 | The hard solution fails to start, using a soft solution |
2107 | The current video frame is not continuous and may drop frames |
2108 | The current flow hardens the first I-frame and the SDK automatically solves the solution |
3001 | RTMP -DNS resolution failed |
3002 | The RTMP server connection failed |
3003 | The RTMP server handshake failed |
3005 | RTMP failed to read/write, after which a network retry is initiated |
The key name | Description |
---|---|
videoBitrate | The bit rate, kbps, of the current video codec output |
audioBitrate | The bit rate, kbps, of the current audio codec output |
videoFPS | The current video frame rate |
videoGOP | The current video GOP, which is the length of each two key frames (I-frames) interval, in s |
netSpeed | The current send/receive speed |
netJitter | A network jitter condition of 0 indicates that there is no jitter, and a higher value indicates that the greater the network jitter, the more unstable the network |
videoWidth | The width of the video screen |
videoHeight | The height of the video screen |
The live-player window supports three trigger modes (set the picture-in-picture-mode property on the component):
In addition, the windows support the following features:
When the player enters window mode, the page on which the player is located is in a hide state (triggering the onHide life cycle) and the page is not destroyed. When the window is closed, the page on which the player is located is unload (triggering the onUnload lifecycle).
<live-player src="https://domain/pull_stream" rel="external nofollow" mode="RTC" autoplay bindstatechange="statechange" binderror="error" style="width: 300px; height: 225px;" />
Page({
statechange(e) {
console.log('live-player code:', e.detail.code)
},
error(e) {
console.error('live-player error:', e.detail.errMsg)
}
})