Home > Mobile >  Tip: in the program of WeChat small stop recording actions occur abnormal... Great god help me, plea
Tip: in the program of WeChat small stop recording actions occur abnormal... Great god help me, plea

Time:09-16

Var RecrodTask=' ';
Mui (' body '.) on (' hold ', 'voicebtn', function (event) {
Try {
event.preventDefault();
} the catch (e) {
console.log(e);
}
JQuery (this). The text (' loose end ');
START=new Date (). GetTime ();
RecordTimer=setTimeout (function () {
Wx. StartRecord ({
Success: the function () {
LocalStorage. RainAllowRecord='true';
}
, cancel the function () {
Util. Toast (" cancelled ", ", "error");
}
});
}, 300);
});
Mui (' body '.) on (' release 'and' voicebtn ', function (event) {
Try {
event.preventDefault();
} the catch (e) {
console.log(e);
}
JQuery (this). The text (' hold the talk ');
END=new Date (). GetTime ();
If ((END - START) & lt; 1000) {
//is less than 1000 ms, not recording
Util. Toast (" recording time is too short ", ""," error ");
END=START=0;
SetTimeout (function () {wx. StopRecord ()}, 800);
ClearTimeout (recordTimer);
} else {
Wx. StopRecord ({
Success: the function (res) {
Voice. The localId=res. LocalId;
Var yuyintime=(END - START);
UploadVoice (yuyintime);
ClearTimeout (recordTimer);
},
Fail: function (res) {
console.log(res);
Util. Toast (" stop the recording actions anomalies (0) ", ""," error ");
ClearTimeout (recordTimer);
}
});
}
});
How to implement the tape will not appear in the program of small abnormal "errors" stop the recording
  • Related