How does WeChat Mini Programs support peripherals?
This article mainly explains "how WeChat Mini Programs supports peripherals". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn how WeChat Mini Programs supports peripherals.
In the development of WeChat Mini Programs, we will use Bluetooth, cameras, recording and other equipment. When using these devices, we can obtain the authorization of the user before operating.
1. The use of the camera, the use of the camera mainly includes taking pictures and shooting videos, both of which are when users upload pictures, we can choose to shoot and upload them by adding the camera attribute in soureType. After uploading, we can get the temporary paths of these videos and pictures, and add tags or tags to the page to display the uploaded videos or pictures, but this temporary path cannot be saved. You need to upload it to your own server to save it. (note: when using video tags).
BindButtonTap: function () {var that = this wx.chooseVideo ({sourceType: ['album',' camera'], maxDuration: 60, camera: ['front',' back'], success: function (res) {console.log (res); that.setData ({src: res.tempFilePath / / tempfilepath is the temporary path for file upload})}}) }
2. Bluetooth, network status, phone calls and other devices can be accessed and opened directly using the interface provided by Wechat. In particular, there are screenshot trigger events (wx.onUserCaptureScreen), clipboard set and get events (wx.setClipboardData), and events that make the phone vibrate (wx.vibrateLong) in Wechat.
Thank you for your reading. the above is the content of "how to support peripherals by WeChat Mini Programs". After the study of this article, I believe you have a deeper understanding of how WeChat Mini Programs supports peripherals. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!