Coder Social home page Coder Social logo

Comments (11)

xiangyuecn avatar xiangyuecn commented on May 16, 2024

这问题就复杂了。。。

可以先把所有录音相关的代码和库全部移除试试长按后能不能收到touchend

如果能收到touchend,在加上JsBridge任意数据收发再测一遍,如果有JsBridge的话

如果能收到touchend,把录音功能一点点的加上,先加open测一遍,一直测到stop看看是哪个地方加上后有问题,然后好针对性的解决

from recorder.

xiangyuecn avatar xiangyuecn commented on May 16, 2024

如果用的JsBridge,并且是重写的prompt,可能是会有问题,有时间我测试一下prompt

from recorder.

xiangyuecn avatar xiangyuecn commented on May 16, 2024

Android App demo里面的长按录音不会触发touchend。

(测试方法错误)纯粹的H5录音就没有这个问题,IOS App的JsBridge也没有这个问题,有时间再研究研究这个bug


经过反复研究发现,是WebView中请求录音权限时,demo app每次都会调用Activity.requestPermissions方法来获得权限,而requestPermissions会造成WebView打断touch事件,进而产生H5、AppNative原生录都会产生此问题;最后把demo app内精简掉的checkSelfPermission加上检测一下是否已授权,就没有此问题了。

此bug在新的Android Demo App里面已修复。

from recorder.

zhengyn0001 avatar zhengyn0001 commented on May 16, 2024

我发现这边还是有问题啊,有时可以松开手结束,有时不行,我发现程序在不断的进行window.AppJsBridgeRequest这个方法的执行
image
image

from recorder.

xiangyuecn avatar xiangyuecn commented on May 16, 2024

核心的action没有打印出来。应该是recordAlive调用,native-config中录音开始后会开启一个5秒的定时器,定时发送recordAlive心跳,Native层超过时间没有收到心跳就会自动关闭录音。这就导致了AppJsBridgeRequest在不停的被调用。

你试试我的那个Android demo app是不是也会有时松开手不能停止录音,我这反复测不出来这个情况现在。

注意:H5里面touch事件除了要监听touchend,还要监听touchcancel,这两个都算手松开了

from recorder.

zhengyn0001 avatar zhengyn0001 commented on May 16, 2024

from recorder.

zhengyn0001 avatar zhengyn0001 commented on May 16, 2024

我刚试了,给其中的录制按钮加上touchstart,touchend时间,按就了就会出现那个长按复制的字,然后松开手录音没有结束,以及我这边的项目的touchcancal执行的时间好像不太对,感觉是刚开始就执行了touchcancel,松开手还是没有监听到touchend的打印

image

from recorder.

xiangyuecn avatar xiangyuecn commented on May 16, 2024

看你截图那是一调用请求权限就立马执行了touchcancel,Android里面打个断点看看是不是走了Activity.requestPermissions方法,只要走了这个方法就会导致touchcancel。 我后面是把checkSelfPermission加了回去,只要有权限了就不走Activity.requestPermissions,就没有touchcancel了。

另外长按出现复制这个可以参考我的代码,注意首尾这两行:

$("body").css("user-select","none");//kill all 免得渣渣浏览器里面复制搜索各种弹,这些浏览器单独给div设置是没有用的
rtcVoiceDownHit=setTimeout(function(){
rtcVoiceStart=true;
//开始录音
recstart(function(err){
if(err){
rtcVoiceStart=false;
rtcMsgView("[错误]"+err,false);
return;
};
if(rtcVoiceStart){//也许已经up了
elem.css("background","#f60").text("松开结束录音");
};
});
},300);
}).bind("mouseup touchend touchcancel",function(e){
if(rtcVoiceDownHit || rtcVoiceStart){
$("body").css("user-select","");

from recorder.

zhengyn0001 avatar zhengyn0001 commented on May 16, 2024

image
狂点录音按钮, 录音报错, 会触发destroy函数, 但是其他线程引用了main.Log 打日志, 但是main已经是 null
image
image

from recorder.

xiangyuecn avatar xiangyuecn commented on May 16, 2024

我研究研究,估计ios也会有这个问题😂

from recorder.

xiangyuecn avatar xiangyuecn commented on May 16, 2024

Android里面 构造函数 和 destroy 加了一个synchronized就没有多大问题了,其他线程同步一下就没有这个狂点导致崩溃的了

from recorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.