WeChat applet implementation recording function

The example of this article shared the specific code of the WeChat applet recording function for everyone, for the reference, the specific content is as follows


       Storage path: {{item.filepath}}   Storage time: {{item.createtime}}   {{item.size}} KB                Press and hold recording         / * pages / index / release / release.wxss * /. Microphone {position: fixed; Left: 250rpx; bottom: 0; Height : 240rpx; Width: 240rpx; border-radius: 20rpx; margin: 50% auto; background: # 26a5ff;} .Item-style {margin-top: 30rpx; margin-bottom: 30 rpx;} .text-style {text- Align: center;} .record-style {PositioN: fixed; bottom: 0; Left: 0; Height: 120rpx; width: 100%;} .btn-style {margin-left: 30rpx; margin-right: 30rpx;} .sound-style {position: absolute; width : 74rpx; Height: 150rpx; margin-top: 45rpx; margin-left: 83rpx;} .board {overflow: hidden; border-bottom: 2RPX Solid # 26a5ff;} / * Column layout * / .Cell {Display: flex; Margin: 20rpx;} .cell-hd {margin-left: 10rpx; color: # 885a38;} .cell .cell-bd {flex: 1; position: relative;} / ** only display a line * / .date {font -Size: 30rpx; Text-overflow: Ellips; WHITE-SPACE: NOWRAP; overflow: hidden;}    

// pages / index / release / release.jsvar app = getapp () page ({data: {j: 1, // frame animation initial picture isspeaking: false, // is talking Voices: [] , // audio array}, online: function () {}, // Finger Press TouchDown: Function () {Console.log (“Finger Press …”) Console.log (“New Date: + New Date) Var_this = this; speaking.call (this); this.SetData ({Isspeaking: true}) // Start recording wx.startRecord ({Success: Function (res) {// temporary path, the next time you enter the applet, you cannot use it normally. Var TempFilePath = Res.TempFilePath Console.log (“TempFilePath:” + TempFilePath) // Permanent Save wx.savefile ({TempFilePath: TempFilePath, Success: Function (RES) {// Persistent Path // Limited size limit for local file storage is 100M var savedfilepath = res.savedfilepath console.log (“SavedFilePath:” + SavedFilePath)} wx.showtoast ({Title: ‘Congratulations! Recording success’, icon: ‘Success’, Duration: 1000}) // Get recording Audio list wx.getsavedfilelist ({successdfilelist ({success) {var voices = []; for (var i = 0; i
The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment