- 浏览: 88163 次
文章分类
- 全部博客 (15)
- 强制刷新 (0)
- 动态设定 (0)
- android (10)
- source collect (0)
- tools (2)
- wireshark (2)
- java (1)
- RandomAccessFile (0)
- home key (0)
- surfaceview 居中 (0)
- 视频工具 (0)
- animation (0)
- net (0)
- 抓包 (0)
- MediaRecorder (1)
- listview (1)
- gridview (0)
- api demo (1)
- php (0)
- linux (0)
- movie (0)
- english (0)
- game (0)
- cygwin (0)
- object C (0)
- mina (1)
- tcp (0)
- udp (0)
- error (2)
- c++ (0)
- time (1)
- utc (1)
- gmt (1)
- ea (0)
- eap (0)
- uml (0)
- other (0)
- web (1)
- jnlp (1)
- sakai (1)
- demo (1)
- tomcat (1)
- sn (0)
- 缓存 (1)
- 网络连接 (1)
- clone (1)
- fragment (1)
最新评论
-
绿茵好莱坞:
好文 ,值得学习
如何让Android模拟器能访问到本地Server或Web应用(即:运行模拟器的PC) -
diyangxia:
看起来比较靠谱
Media start error原因分析及解决方法 -
whhpc19891120:
大哥,还是用了你的方法问题还是存在
Media start error原因分析及解决方法 -
dndxcsy:
好帖!总算在这里找到HH:mm:ss和hh:mm:ss会返回2 ...
Android系统时间制式的获取(24小时制式/12小时制式)及UTC与本地时间的转换
之前在项目的时候,遇到到Media Recorder在快速启动停止等一系列操作的后,再次启动时,会failed的问题,类似的Log如下:
ERROR/MediaRecorder(9008): start failed: -19
WARN/dalvikvm(9008): threadid=15: thread exiting with uncaught exception (group=0x40ad01f8)
ERROR/AndroidRuntime(9008): FATAL EXCEPTION: Thread-337
ERROR/AndroidRuntime(9008): java.lang.RuntimeException: start failed.
ERROR/AndroidRuntime(9008): at android.media.MediaRecorder.start(Native Method)
ERROR/AndroidRuntime(9008): at com.huawei.ca.eivs.camera.AndroidVideo.initMediaRecoder(AndroidVideo.java:429)
ERROR/AndroidRuntime(9008): at com.huawei.ca.eivs.camera.AndroidVideo.sendLiveToMdu(AndroidVideo.java:511)
ERROR/AndroidRuntime(9008): at com.huawei.ca.eivs.camera.AndroidVideo$ListenInviteThread.run(AndroidVideo.java:241)
WARN/ActivityManager(210): Force finishing activity com.huawei.ca.eivs.ui/com.huawei.ca.eivs.camera.AndroidVideo
ERROR/ActivityManager(210): exception bw.write()java.io.IOException: Transport endpoint is not connected
这个时候,退出自己的软件,打开系统相机,会提示“相机故障,无法连接到相机”,只能重启机器才能正常使用系相机。
根据反复测试抓log发现,造成MediaRecorder start失败的原因是:在程序中反复启动停止MediaRecord时,存在在无效的状态上stop MediaRecorder的情况,而且没有捕获此操作引发的异常,没有对MediaRecorder进行reset、release造成的。
具体的MediaRecorder状态迁移,请参看SDK。
解决办法:
解决这个问题的关键是保证MediaRecorder能在合适的状态执行合适的动作。
下面是我的解决方法,希望能给遇到这个问题的人一个灵感:
private void releaseMediaRecorder()
{
if (mMediaRecorder != null)
{
// 内部标识是否正在录像的变量,如果不需要可以去掉
if (isRecord)
{
try
{
mMediaRecorder.setOnErrorListener(null);
mMediaRecorder.setOnInfoListener(null);
// 停止
mMediaRecorder.stop();
}
catch (RuntimeException e)
{
e.printStackTrace();
// 如果发生异常,很可能是在不合适的状态执行了stop操作
// 所以等待一会儿
try
{
Thread.sleep(100);
}
catch (InterruptedException e1)
{
Log.e(TAG, "sleep for second stop error!!");
}
}
isRecord = false;
}
// 再次尝试停止MediaRecorder
try
{
mMediaRecorder.stop();
}
catch (Exception e)
{
Log.e(TAG, "stop fail2", e);
}
// 等待,让停止彻底执行完毕
try
{
Thread.sleep(100);
}
catch (InterruptedException e1)
{
Log.e("TAG", "sleep for reset error Error", e1);
}
// 然后再进行reset、release
mMediaRecorder.reset();
mMediaRecorder.release();
mMediaRecorder = null;
}
}
这是我经历痛苦后的总结,希望能对遇到类似问题的同伴有点帮助~
发表评论
-
Android类参考---Fragment(一)
2015-01-10 08:56 16221 继承关系 java.lang.Object |__ ... -
Activity的四种加载模式 -- singleTask 和 singleInstance模式
2014-03-07 10:54 4581Activity的启动模式可以通过AndroidMani ... -
如何让Android模拟器能访问到本地Server或Web应用(即:运行模拟器的PC)
2013-08-29 14:44 7591I、让人烦躁的问题 近日,在移植Mina框架到Androi ... -
Eclipse中运行程序,提示ADB server didn't ACK failed to start daemon
2013-07-26 15:32 1498今天在eclipse中运行程序时,提示: ADB ser ... -
【转载】 Android ListView性能优化之视图缓存
2013-07-19 16:31 970转载自: 博客园:http://www.cnblo ... -
android 错误解决方法 ---积累中
2013-07-18 10:19 53471 在android编程中出现cannot be reso ... -
android htttp 下载
2013-03-20 15:04 0ttt -
Android系统时间制式的获取(24小时制式/12小时制式)及UTC与本地时间的转换
2013-03-01 10:59 12941I、获取系统时间制式(12小时制/24小时制) 1 ... -
android error
2013-01-10 18:17 0android 模拟器 Installation error: ... -
android mina使用
2012-12-25 17:39 0http://wmiao89620.iteye.com/blo ... -
android + js
2012-12-04 17:17 0Android中 Js 扩展及交互 . http://blog ... -
Android 资料
2012-12-03 10:08 0http://blog.csdn.net/tangcheng_ ... -
Android API Demo框架分析
2012-11-23 16:36 1809闲着没事儿,看了下Android API Demo的代码,发 ... -
GridView或ListView 中android:drawSelectorOnTop的用法(转)
2012-09-28 16:04 0android:drawSelectorOnTop=&quo ... -
android 抓包方法
2012-09-13 19:35 0看到网上有朋友写了一个手机抓包工具,是一个apk,直接安装 ... -
anroid画面平滑上移
2012-08-30 21:29 0http://blog.csdn.net/pgalxx/art ... -
PreferenceActivity
2012-08-28 22:46 0SystemSetAcitivity.java pub ... -
android退出对话框
2012-08-24 17:39 0private void showExitDialog() ... -
surfaceview 居中
2012-08-20 17:54 0<LinearLayout xmlns:android= ... -
android源代码
2012-08-16 22:48 04.0 http://download.csdn.net/d ...
相关推荐
try { // create a player to play the media specified in the ...mediaPlayer.start() // start playing the media clip } catch (Exception iOException) { System.err.println("Error reading from the source") }
You can start downloading pictures (or other media content) quickly, simply after inputting the address of the first page with gallery. Smart page analyzer will follow every link on the page or script...
var i={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},a={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",...
- 32-bit BurnInTest PRO 5.3.1020 would not start on Windows 2000. This has been corrected. Release 5.3 build 1020 WIN32 release 29 May 2008 - BurnInTest could have crashed on accessing bad video ...
UMP is universal Media Framework plugin for Unity that based on Video LAN Codec (libVLC) native libraries. Support E-mail: unitydirectionkit@gmail.com Try: Demo (Win64) Demo (Mac64) Important: - ...
strcat (PreviewDir, "media\\levels\\"); _makepath (DestBspName, PreviewDrive, PreviewDir, Name, Ext); */ // make dest path same as source path strcpy(DestBspName, PreviewFilename); } // if ...
《C#全能速查宝典》共分为8章,分别介绍了C#语言基础、Windows窗体及常用控件、Windows高级控件、控件公共属性、方法及事件、数据库开发、文件、数据流与注册表、GDI+绘图技术和C#高级编程,共包含562个C#编程中常用...
Scope and features of the MPEG-4 standard m 1.1 Coded representation of media objects m 1.2 Composition of media objects m 1.3 Description and synchronization of streaming data for media ...
正在分析软件包的依赖关系树 正在读取状态信息... 完成 下列软件包是自动安装的并且现在不需要了: fakeroot libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libfakeroot Use 'apt-...
Toast.makeText(MainActivity.this, "ActivityResult resultCode error", Toast.LENGTH_SHORT).show(); return; } switch(requestCode) { case 1: Log.d(TAG, "onActivityResult,1,"+outputImage...
the Software will be uninterrupted or error free. Matsushita will not be liable for any damage suffered by Licensee arising from or in connection with Licensee's use of the Software. Copyright: ...
常见安装失败输出代码、含义及可能的解决办法如下: 输出 含义 解决办法 INSTALL_FAILED_ALREADY_EXISTS 应用已经存在,或卸载了但没卸载干净 adb install 时使用 -r 参数,或者先 adb uninstall <packagename> 再...
R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c 2、 R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile ...
R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\hm1375.c 2¡¢ R:\wyb\thl_r16_tinav2.0_hm1375\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\Makefile EXTRA...
Error Count (bad media) 0 Error Count (other) 5874 Last Error Win32 error: (0x00000037) The specified network resource or device is no longer available. Remote Drives AsyncIo : 0 Image Devices ...
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ File dir = Environment.getExternalStorageDirectory();//文件保存目录 System.out.println("文件保存目录=="+dir);...
public boolean onError(MediaPlayer mp, int what, int extra) { // TODO Auto-generated method stub return false; } //Video播完的时候得到通知 @Override public void onCompletion(MediaPlayer mp) { ...
E/WifiConfigStore( 1670): Error parsing configurationjava.io.FileNotFoundException: /data/misc/wifi/ipconfig.txt: open failed: ENOENT (No such file or directory) D/BluetoothAdapter( 1931): 1103979928:...
error: function (){} }; // normalize environment var RTCPeerConnection = null, getUserMedia = null, attachMediaStream = null, reattachMediaStream = null, browser = null, webRTCSupport = true; ...
In the event the system is restarted, it will start capturing data early in the system startup process. <br>If Bus Hound is exited while stopped, no capture will occur until returning to the ...