调用处于无效状态的Android应用程序setOutputFormat:1 [英] Android application setOutputFormat called in an invalid state: 1

查看:124
本文介绍了调用处于无效状态的Android应用程序setOutputFormat:1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hiiii,



我正在开发一个在线视频流应用......我需要通过wifi将捕获的视频从一个Android设备发送到另一个设备.. .at目前我需要通过套接字连接流式传输捕获的视频,并将视频文件保存在其他设备中。我能够在设备之间建立套接字连接并保存离线视频......还可以捕获视频并保存sdcard中的视频文件...现在我必须在捕获视频时保存文件..





Hiiii,

I am developing a online video streaming application...i need to send the captured video from one android device to another device over wifi...at present i need to just stream the captured video over socket connection and save the video file in other device.. i am able to establish socket connection between the devices and save an offline video...and also capture the video and save the video file in sdcard...now i have to save the file while its capturing the video..


clientSocket = new Socket(SERVERIP,SERVERPORT);
                             pfd = ParcelFileDescriptor.fromSocket(clientSocket);
 mediaRecorder.setOutputFile(pfd.getFileDescriptor());









结果强制关闭申请并导致例外,因为





E / MediaRecorder(9341) :setOutputFormat在无效状态下调用:1




即使我指定输出格式也是



mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);



或者如果我删除也会得到相同的例外





并导致一系列错误和申请人关闭







It results in force close of an application and result in exception as


E/MediaRecorder(9341): setOutputFormat called in an invalid state: 1


even though if i specify the output format also

mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);

or if i remove also i am getting the same exception


and results in a series of error and application force close

09-02 11:55:34.671: E/MediaRecorder(9341): setOutputFormat called in an invalid state: 1
09-02 11:55:34.671: D/AndroidRuntime(9341): Shutting down VM
09-02 11:55:34.671: W/dalvikvm(9341): threadid=1: thread exiting with uncaught exception (group=0x40018578)
09-02 11:55:34.718: E/AndroidRuntime(9341): FATAL EXCEPTION: main
09-02 11:55:34.718: E/AndroidRuntime(9341): java.lang.IllegalStateException
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.media.MediaRecorder.setOutputFormat(Native Method)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.media.MediaRecorder.setProfile(MediaRecorder.java:323)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at com.exercise.AndroidVideoCapture.AndroidVideoCapture.prepareMediaRecorder(AndroidVideoCapture.java:142)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at com.exercise.AndroidVideoCapture.AndroidVideoCapture.access$5(AndroidVideoCapture.java:132)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at com.exercise.AndroidVideoCapture.AndroidVideoCapture$1.onClick(AndroidVideoCapture.java:105)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.view.View.performClick(View.java:2485)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.view.View$PerformClick.run(View.java:9080)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.os.Handler.handleCallback(Handler.java:587)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.os.Handler.dispatchMessage(Handler.java:92)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.os.Looper.loop(Looper.java:130)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at android.app.ActivityThread.main(ActivityThread.java:3687)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at java.lang.reflect.Method.invokeNative(Native Method)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at java.lang.reflect.Method.invoke(Method.java:507)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-02 11:55:34.718: E/AndroidRuntime(9341): 	at dalvik.system.NativeStart.main(Native Method)





我一直在收到这个问题并且无法找到合适的解决方案....我正在Android版2.3.6上运行Android应用程序版本....





谢谢和问候,

Divya



I have been getting this issue and not able to find proper solution....i am working on android application version on Android version 2.3.6....


Thanks and Regards,
Divya

推荐答案

5(AndroidVideoCapture.java:132)
09-02 11:55 :34.718:E / AndroidRuntime(9341):at com.exercise.AndroidVideoCapture.AndroidVideoCapture
5(AndroidVideoCapture.java:132) 09-02 11:55:34.718: E/AndroidRuntime(9341): at com.exercise.AndroidVideoCapture.AndroidVideoCapture


1.onClick(AndroidVideoCapture.java:105)
09-02 11:55: 34.718:E / AndroidRuntime(9341):在android.view.View.performClick(View.java:2485)
09-02 11:55:34.718:E / AndroidRuntime(9341):at android.view.View
1.onClick(AndroidVideoCapture.java:105) 09-02 11:55:34.718: E/AndroidRuntime(9341): at android.view.View.performClick(View.java:2485) 09-02 11:55:34.718: E/AndroidRuntime(9341): at android.view.View


PerformClick.run(View.java:9080)
09-02 11:55:34.718:E / AndroidRuntime(9341):at android.os.Handler.handleCallback( Handler.java:587)
09-02 11:55:34.718:E / AndroidRuntime(9341):在android.os.Handler.dispatchMessage(Handler.java:92)
09-02 11: 55:34.718:E / AndroidRuntime(9341):在android.os.Looper.loop(Looper.java:130)
09-0 2 11:55:34.718:E / AndroidRuntime(9341):在android.app.ActivityThread.main(ActivityThread.java:3687)
09-02 11:55:34.718:E / AndroidRuntime(9341):at java.lang.reflect.Method.invokeNative(Native Method)
09-02 11:55:34.718:E / AndroidRuntime(9341):at java.lang.reflect.Method.invoke(Method.java:507)
09-02 11:55:34.718:E / AndroidRuntime(9341):at com.android.internal.os.ZygoteInit
PerformClick.run(View.java:9080) 09-02 11:55:34.718: E/AndroidRuntime(9341): at android.os.Handler.handleCallback(Handler.java:587) 09-02 11:55:34.718: E/AndroidRuntime(9341): at android.os.Handler.dispatchMessage(Handler.java:92) 09-02 11:55:34.718: E/AndroidRuntime(9341): at android.os.Looper.loop(Looper.java:130) 09-02 11:55:34.718: E/AndroidRuntime(9341): at android.app.ActivityThread.main(ActivityThread.java:3687) 09-02 11:55:34.718: E/AndroidRuntime(9341): at java.lang.reflect.Method.invokeNative(Native Method) 09-02 11:55:34.718: E/AndroidRuntime(9341): at java.lang.reflect.Method.invoke(Method.java:507) 09-02 11:55:34.718: E/AndroidRuntime(9341): at com.android.internal.os.ZygoteInit


这篇关于调用处于无效状态的Android应用程序setOutputFormat:1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆