Home  >  Article  >  WeChat Applet  >  Answers to questions about WeChat mini program live-pusher

Answers to questions about WeChat mini program live-pusher

小云云
小云云Original
2018-02-07 15:58:575229browse

This article mainly shares with you the pitfalls of the WeChat applet live-pusher. Recently, I am using the WeChat applet to implement real-time calls. One page uses both live-pusher and live-player. I stepped on many pitfalls along the way, so I will summarize it here, hoping it can help everyone.

1 Problem: Live-player has no sound while playing

Cause: When you perform start, stop, resume and other operations on live-pusher, all playing will be stopped. live-player sound. (It has not been found that calling live-pusher's pause will cause this problem.)

Two solutions:

One is to avoid operating live-pusher after live-player plays. For example, enter the page and directly enable live-pusher, and then do no more operations. The official DEMO uses this solution.

The second method is to re-call the play operation of live-player after each operation of live-pusher (it feels like a short delay in calling is required). However, this will cause a brief interruption of the live-player audio and video being played, and the experience is not very good, so if the business permits, the first method is more recommended.

2 Problem: After Live-pusher calls start, it appears randomly and returns successfully, but no video is displayed.

Cause: In this case, the OnPush callback will not be received. It seems to be related to the initialization of the page tag, the setting of the URL, and the timing of calling start.

Solution:

When OnLoad, set the URL of the label. The call to wx.createLivePusherContext should be placed after onReady. If you cannot set the URL at the beginning, you can use wx:if to control the live-pusher tag in wxml and wait until the URL is set.

3 Problem: The enable-camera attribute seems to be invalid

Solution: The correct writing method for bool type attributes should be like this: [enable-camera="{{enable}}" ]

4 Problem: After calling the start of live-pusher, no incoming callbacks for success, failure, and completion were called, and no video appeared.

Cause: During a certain test, the camera pop-up When applying for permission, it was rejected. This setting is bound to the WeChat account. This may be the case when a certain WeChat account fails to appear.

Solution: In WeChat, click Discover->Mini Program, delete your application there, scan the code to enter again, the permission application will pop up again, just agree.

5 Question: When using wxml and wx:for to bind an array to a group of live-players, if the array content is modified multiple times, there will be one more live-player on the interface. After multiple tests, it was determined that the contents of the array were correct

Reason: This is the most amazing BUG in my opinion, and it is difficult to clearly describe what happened, but fortunately I found a solution.

Solution: In the .json file, just add the sentence ‘"usingComponents": {}’.

6 Problem: The iPad version of WeChat scans the QR code of the mini program is invalid

Reason: The mini program currently only supports mobile phones.

7 Problem: live-pusher displays a red error, saying that rendering failed and access denied

Reason: live-pusher is currently only open to some categories of applications and needs to be set on the website. If it still doesn't work after setting up, try deleting the mini program and reinstalling it, exiting WeChat, etc. It will succeed.

To summarize the solutions to the above problems, I feel that the most important thing is patience and meticulousness.

Related recommendations:

Detailed example of encapsulation of wx.request in WeChat applet

WeChat applet swiper component construction wheel Botu code sharing

Instance of WeChat applet authorization to obtain user details

The above is the detailed content of Answers to questions about WeChat mini program live-pusher. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn