# live-pusher

Start from base library version 1.7.0. Please remaining backward compatible.

Mini Program plugin: Support, the need for the Mini Program base library version is not less than 2.3.0

WeChat Windows edition: Support

WeChat Mac edition: Support

Relevant api: wx.createLivePusherContext

# Functional description

Live Audio and Video Recording (v2.9.1 Support fromSame layer rendering)。 NeedUser Authorization scope.camerascope.record

# Apply for Open

For the time being, it is only open for the following categories of domestic entities, which need to pass the category audit first, and then in the background of the Mini Program management.Development-Interface settingsEnable the component permission in the.

Category I/Subject type Class II Mini Program Content Scene
Social contact live broadcast Involves the entertainment nature, such as the star live, the life interesting live, the pet live and so on. After selecting this type of project, the code is submitted for the first time for review and verification by the local Internet authority, and it is expected that the review will take about 7 days.
education Online Video Lessons Online courses, online training, lectures and other educational live broadcast
Medical care Internet hospitals, public medical institutions, other private medical institutions Live interviews, large health talks, etc.
Finance Bank, trust, public fund, private fund, securities/Futures, securities, futures investment consulting, insurance, credit investigation business, NEEQ information service platform, stock information service platform (Hong Kong stocks/U.S. Stocks), Consumer Finance, Financing Guarantees Financial product video customer service claims, financial product promotion live, etc.
automobile Car Pre-sale Service Pre-sale and promotion of automobiles
Government Principal Account / Government related work to promote live broadcast, live leadership speech, etc.
IT Technology Multi-party communicationAudio and video equipment Provide services such as teleconferencing/video conferencing for multiple parties; control cameras in smart home scenarios
Real Estate Services Real Estate Marketing Real Estate Marketing Live Broadcast Service, Online Audio and Video Tape Watch, etc.
Business services notarization Online Business Processing, etc.

# Property Dxplaination

attribute type Default value Required Introductions Minimum version
url string no Push stream address. Currently only support rtmp format 1.7.0
mode string RTC no SD(standard definition), HD(HD), FHD(Super clear), RTC(Live Call) 1.7.0
autopush boolean false no Automatic push flow 1.7.0
enableVideoCustomRender boolean false no Custom rendering, which allows developers to process captured video frames themselves, seeLivePusherContext 2.29.0
muted boolean false no Whether to mute. Soon to be abandoned, available enable-mic Replace 1.7.0
enable-camera boolean true no Turn on the camera. 1.7.0
auto-focus boolean true no Automatic aggregation 1.7.0
orientation string vertical no Screen Direction 1.7.0
Legal value Introductions
vertical vertical
horizontal level
beauty number 0 no Beauty, range of values 0-9 ,0 Indicates Closed 1.7.0
whiteness number 0 no Whitening, Range of Values 0-9 ,0 Indicates Closed 1.7.0
aspect string 9:16 no Aspect ratio, the optional values are 3:4, 9:16 1.7.0
min-bitrate number 200 no Minimum bit rate 1.7.0
max-bitrate number 1000 no Maximum bit rate 1.7.0
audio-quality string high no High sound quality(48KHz)Or low sound quality(16KHz), the value ishigh, low 1.7.0
waiting-image string no Wait for the stream when entering the background 1.7.0
waiting-image-hash string no MD5 Value for Waiting Screen Resource 1.7.0
zoom boolean false no Adjust the focal length 2.1.0
device-position string front no Front or back, the value isfront, back 2.3.0
background-mute boolean false no Whether to mute when entering the background (abandoned, default background mute) 1.7.0
mirror boolean false no Set whether the push stream screen is mirrored or not, and the effect is in live-player Reaction to the 2.7.0
remote-mirror boolean false no with mirror Properties, Subsequent mirror Will be abandoned 2.10.0
local-mirror string auto no Controls whether the local preview screen is mirrored 2.10.0
Legal value Introductions
auto The front camera mirrors, the rear camera does not mirror
enable Front and rear cameras are mirrored
disable Front and rear cameras are not mirrored
audio-reverb-type number 0 no Audio Reverb Type 2.10.0
Legal value Introductions
0 Stop
1 KTV
2 Small room
3 Hall
4 Low
5 Resonant
6 Metallic sound
7 magnetic
enable-mic boolean true no Turn the microphone on or off 2.10.0
enable-agc boolean false no Turn on audio auto gain 2.10.0
enable-ans boolean false no Turn on audio noise suppression 2.10.0
audio-volume-type string auto no Volume Type 2.10.0
Legal value Introductions
auto automatic
media Media volume
voicecall Call volume
video-width number 360 no Resolution width of the pushed video stream 2.10.0
video-height number 640 no The resolution height of the pushed video stream 2.10.0
beauty-style string smooth no Set Beauty Type 2.12.0
Legal value Introductions
smooth Smooth Beauty
nature Natural beauty
filter string standard no Set Color Filter 2.12.0
Legal value Introductions
standard standard
pink Pink and tender
nostalgia Nostalgia
blues blues
romantic romantic
cool Cool and refreshing
fresher fresh
solor Japanese section
aestheticism aesthetics
whitening to whiten
cerisered Cherry red
picture-in-picture-mode string/Array no Set the small window mode: push, Pop, empty character strings, or multiple modes such as ["push", "pop"]) 2.25.0
Legal value Introductions
[] Cancel the window.
push routing push Small window triggered
pop routing pop Small window triggered
voice-changer-type number 0 no 0: Turn Off Variable Sound1: Bear Child2: Lori3: Uncle4: Heavy Metal6: Foreigners7: Trapped Beast8: Dead Fat Boy9: Strong Current10: Heavy Machinery11: Ethereal 2.31.0
custom-effect boolean false no Whether to start custom effects, can not be changed after setting 2.29.1
skin-whiteness number 0 no Custom whitening effect, value 01。 Need to open custom-effect 2.29.1
skin-smoothness number 0 no Custom Special Effects Dermabrasion Effect, Value 01。 Need to open custom-effect 2.29.1
face-thinness number 0 no Custom special effect face-lift effect, value 01。 Need to open custom-effect 2.29.1
eye-bigness number 0 no Custom special effects big eye effect, value 01。 Need to open custom-effect 2.29.1
fps number 15 no Frame rate, the valid value is 130 2.31.0
bindingstatechange eventhandle no Change of state event, detail = {code} 1.7.0
bindingnet status eventhandle no Network status notification, detail = {info} 1.9.0
binderror eventhandle no Render error event, detail = {errMsg, errCode} 1.7.4
bindbgmstart eventhandle no Triggered when the background sound starts playing 2.4.0
bindbgmprogress eventhandle no Trigger when background tone progress changes, detail = {progress, duration} 2.4.0
bindbgmcomplete eventhandle no Triggered when background sound is completed 2.4.0
bindaudiovolumenotify eventhandle no Returns the volume of microphone acquisition 2.12.0
bindingterpictureinpicture eventhandler no Access to the small window 2.25.0
bindleavepictureinpicture eventhandler no Exit window 2.25.0

# Bug & Tip

  1. tip: Not supported on developer tools.
  2. tiplive-pusher Default width is 100%, no default height, please set width and height through wxss.
  3. tipwaiting-image Property in the 2.3.0 Full support for network paths, temporary files, and in-package paths.
  4. tip: Please noteNative Component Usage Restrictions
  5. tip: The relevant introduction and principle can refer toThis article

# Error code (errCode)

code Introductions
10001 Users are prohibited from using cameras
10002 User is prohibited from recording
10003 Background Sound Resource (BGM) Load Failed
10004 Wait screen resource (waiting-image) failed to load

# Status code (code)

code Introductions
1001 Push stream: Already connected to push stream server
1002 Push Stream: You have finished shaking hands with the server and started pushing stream
1003 Push Stream: Open Camera Successfully
1004 Push Stream: Recording screen started successfully
1005 Push flow: push flow state adjustment resolution
1006 Push flow: push flow state adjustment rate
1007 Push stream: first frame capture completed
1008 Push Stream: Encoder Start
1018 Push flow: into the room success (ROOM protocol specific)
1019 Push flow: check out successfully (ROOM protocol unique)
1020 Push stream: remote anchor list changes (ROOM protocol specific)
1021 Push stream: Reentry when network changes, WiFi Switch to 4 G Will trigger disconnection reconnection (ROOM protocol specific)
1022 Push flow: Failure to enter the room (ROOM protocol specific)
1031 Push stream: remote anchor into the room notification (ROOM protocol specific)
1032 Push stream: remote anchor check-out notification (ROOM protocol specific)
1033 Push stream: remote anchor video status bit change (RROOM-specific)
1034 Push stream: remote anchor audio status bit change (ROOM protocol specific)
1101 Push stream: network condition is not good: uplink bandwidth is too small, upload data blocked
1102 The network is disconnected, Automatic reconnection initiated
1103 Push stream: hard coded boot failure, Using soft coding
1104 Video coding failed, The encoder will restart inside.
3001 Push stream: DNS resolution failed
3002 Push Stream: RTMP Server Connection Failed
3003 Push Stream: RTMP Server Handshake Failed
3004 Push stream: RTMP server is actively disconnected, please check the legality of push stream address or security chain validity
3005 Push Stream: RTMP read/Write failure
4998 When the mic state switches, enable-mic triggers(IOS is unique)
4999 When the mute state is switched, muted trigger(IOS is unique)
5001 System phone interruption or WeChat audio and video phone interruption
10001 Users are prohibited from using cameras
10002 User is prohibited from recording
10003 Background Sound Resource (BGM) Load Failed
10004 Wait screen resource (waiting-image) failed to load
-1301 Push Stream: Failed to open camera
-1302 Push Stream: Failed to open microphone
-1303 Push Stream: Video Coding Failed
-1304 Push Stream: Audio Encoding Failed
-1305 Push Stream: Unsupported Video Resolution
-1306 Push: Unsupported audio sampling rate
-1307 Push Stream: The network is disconnected, and after multiple attempts to reconnect, please restart the push stream by yourself.
-1308 Push stream: start recording screen failed, may be rejected by the user
-1309 Push Stream: Video screen failed, Android system version is not supported, requires a system above 5.0
-1310 Push Stream: Recording screen interrupted by other applications
-1311 Stream:Android Mic turned on successfully, but audio data cannot be recorded
-1312 Push Stream: Failed to record screen dynamic cut horizontal and vertical screen
0 No errors

# Network Status Data (info)

Key Introductions
videoBitrate Current Video Editing/Bit rate of encoder output, unit kbps
audioBitrate Current Audio Edit/Bit rate of encoder output, unit kbps
videoFPS Current Video Frame Rate
videoGOP Current Videos GOP, which is for every two keyframes(I帧)Interval length, unit s
netSpeed Current Send/Receiving speed
netJitter Network jitter situation, the greater the jitter, the more unstable the network
netQualityLevel Network Quality: 0: Undefined 1: Best 2: Good 3: General 4: Poor 5: Very Bad 6: Not Available
videoWidth The width of the video frame
videoHeight The height of the video picture
videoCache The number of video frames piled up on the anchor side
audioCache The number of audio frames stacked on the anchor side

# sample code

Preview with Developer Tool

  <live-pusher url="https://domain/push_stream" mode="RTC" autopush bindstatechange="statechange" style="width: 300px height: 225px" />
Page({
  statechange(e) {
    console.log('live-pusher code:', e.detail.code)
  }
})