# WeChat Channels Live
If the Mini Program is the same as the main body of WeChat Channels or is an associated body, it can jump to the WeChat Channels Live Broadcast Room or initiate a WeChat Channels live broadcast reservation within the Mini Program.
# Substantive judgment
# Subject information query
The main information of the Mini Program can be inquired through the Mini Program Information Page - Development Team, and the main information of the WeChat Channels can be inquired through the Home Page - Authentication of the WeChat Channels.
WeChat Channelsid is required to pass[WeChat Channels Assistant](https://channels.weixin.qq .com /Login)Get.
# Subjective judgment logic
If the Mini Program has the same body as WeChat Channels, the relevant interface can be invoked. If the Mini Program is different from the body of WeChat Channels and the following three conditions are met at the same time, the relevant interface can be called:
- The Mini Program is boundWeChat Open Platformaccount
- The relationship between the Mini Program and the WeChat open platform account is the same subject orRelated subject
- Subjects with WeChat Channels in the list of subjects and associated subjects of WeChat Open Platform accounts The application process for associated subjects can be referred to: https://kf.qq.com/faq/190726e6JFja190726qMJBn6.html
# Get live feeds on WeChat Channels
Developers can use[wx.getChannelsLiveInfo ]((wx.getChannelsLiveInfo ))Interface to get WeChat Channels live id, live status, live theme, WeChat Channels avatar nickname and other live information, the specific use of the following:
From the base library 2.15.0 Start support
The developer passes in WeChat Channelsid (finderUserName parameter), which can get the live stream information of the current or recent live stream, as follows:
- Status = 2, live: feedId and nonceId returned are the current live id, description is the current live topic
- Status = 3, the broadcast has ended: feedId and nonceId returned as the most recent broadcast id, description as the most recent broadcast topic
From the base library 2.29.0 Start support
Developers upload WeChat Channelsid (finderUserName parameter) and start and end time (startTime and endTime parameters) to get all live information within a specified time period. The live stream or the most recent live stream information will be returned directly in the output, and the rest of the live stream information will be returned in the form of a list in otherInfos.
# Methods of Use
# Mini Program Jump to WeChat Channels Live Streaming
From the base library 2.15.0 Start support
Developers first through[wx.getChannelsLiveInfo ]((wx.getChannelsLiveInfo ))The incoming WeChat Channelsid is used to get the live stream information of WeChat Channels, including the live stream id (feedId and nonceId) and the live stream status.
After obtaining the live broadcast information, the developer can access thewx.openChannelsLiveTurn on WeChat Channels Live. If you are not currently live, you will be redirected to the end page of the most recent live broadcast. The interface usage restrictions are as follows:
- Requires the user to trigger the jump, if the user does not click on the Mini Program page anywhere, the developer will not be able to call this interface.
- Users need to confirm the jump, before jumping to WeChat Channels live, will be unified to increase the pop-up window, ask whether to jump, the user can jump to WeChat Channels live after confirmation.
# WeChat Channels Live Stream Embedded in Mini Program
From the base library 2.29.0 Start support
Developers first through[wx.getChannelsLiveInfo ]((wx.getChannelsLiveInfo ))Pass in WeChat Channelsid and start and end time (startTime and endTime parameters), which are used to get WeChat Channels live information for a specified time period, including live id (feedId), live status and live playback status.
After obtaining the live broadcast information, the developer can access thechannel-liveShow the live cover in the mini program, and the user can jump directly to the WeChat Channels live without a pop-up window after clicking. Different live status, jump to WeChat Channels to undertake the page page is different, as follows:
- Live Stream Not Started: The End Page of the Previous Live
- On the Air: Live Page
- Live Stream Ended (No Playback): End of Live page
- Live Stream Is Over (With Playback): live stream playback page
# Make an appointment for WeChat Channels live stream within the Mini Program
From the base library 2.19.0 Start support
Developers first through[wx.getChannelsLiveNoticeInfo ]((wx.getChannelsLiveNoticeInfo ))The incoming WeChat Channelsid is used to get the WeChat Channels live notice id (noticeId). If there is no live notice available to reserve, it will return failure.
After obtaining the live preview information, the developer canwx.reserveChannelsLiveEvoke the reservation pop-up window, the user can make the reservation operation. Successfully arouse the pop-up window is the success of the interface call, through the state can get the user's specific operation behavior:
- state = The user clicks "Cancel" to refuse to go to the live broadcast.
- state = Is live, the user clicks "allow" to go to live
- state = 3 The announcement has been cancelled.
- state = 4 The broadcast is over.
- state = The user did not make an appointment before, and did not make an appointment in the pop-up window directly.
- state = The user had not made an appointment before, and booked a live broadcast in the pop-up window.
- state = The user has previously made an appointment and cancelled the appointment in the pop-up window.
- state = 8, the user has previously made an appointment, directly put away the pop-up window
- state = Before the pop-up window arouses the user to cancel directly
- state = 10, live booking has expired
# Terms of use
- Wx.getChannelsLiveInfo and wx.getChannelsLiveNoticeInfo will call to WeChat background system resources, in order to protect the system, developers please comply withInterface Call Frequency SpecificationDocking port to do a moderate frequency limit, not unlimited call.
- The platform will resolutely crack down on the behavior of inducing to jump to WeChat Channels live broadcast, inducing to make an appointment to WeChat Channels live-broadcast, etc. When using this function, please strictly abide by theWeChat Mini Program Platform Operation Specification。
# Note
- This interface can be called in both the development and experience versions. Developers in the debugging process, you can choose the visible range of WeChat Channels to start broadcasting, easy to test.
- If the Mini Program does not agree with the main body information of WeChat Channels, it will return 100008 error code.
- Wx.getChannelsLiveInfo and wx.getChannelsLiveNoticeInfo callback functions do not inherit the user click event and cannot be recalled wx.openChannelsLive in the success callback of wx.getChannelsLive.
- Developer tools do not support this capability, please use real machine debugging first.