Android视频动作视频捕获问题:

时间:2013-10-11 17:58:37

标签: android android-intent android-camera-intent

我正在编写一个应用程序,我需要能够捕获视频并将其存储到某个位置(以后我可以检索它)。我做了一些谷歌搜索,发现这个Android教程,我需要的更多http://developer.android.com/guide/topics/media/camera.html在这个特定的主题。我完全按照所示的那样实现了意图(在onCreate方法中)并且我传递了一个uri,如示例中所示:

intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name

预先创建目录和视频文件,然后使用Uri.fromFile()直接从File对象获取fileUri。我相对肯定uri不是问题。在nexus 7,galaxy tab等上测试时运行正常。然而,当试图在HTC上运行时,一旦我按下录制按钮,它就会崩溃。如果我不放uri,则记录功能有效。任何有关正在发生的事情的见解都将受到赞赏。

以下是Log Cat:

10-11 17:31:43.915  10912-10924/? E/CameraThread﹕ [START RECORD] Stereo = true
10-11 17:31:43.915  10912-10924/? V/MediaRecorderJNI﹕ setAudioSource(1)
10-11 17:31:43.915  10912-10924/? V/MediaRecorderJNI﹕ getMediaRecorder E
10-11 17:31:43.915  10912-10924/? V/MediaRecorder﹕ setAudioSource(1)
10-11 17:31:43.915  10912-10924/? V/MediaRecorder﹕ Call init() since the media recorder is not initialized yet
10-11 17:31:43.915  10912-10924/? V/MediaRecorder﹕ init
10-11 17:31:43.925      123-220/? V/StagefrightRecorder﹕ init
10-11 17:31:43.925      123-220/? V/StagefrightRecorder﹕ setAudioSource: 1
10-11 17:31:43.925  10912-10924/? V/MediaRecorderJNI﹕ process_media_recorder_call
10-11 17:31:43.925  10912-10924/? V/MediaRecorderJNI﹕ setVideoSource(1)
10-11 17:31:43.925  10912-10924/? V/MediaRecorderJNI﹕ getMediaRecorder E
10-11 17:31:43.925      123-765/? V/StagefrightRecorder﹕ setVideoSource: 1
10-11 17:31:43.925  10912-10924/? V/MediaRecorderJNI﹕ process_media_recorder_call
10-11 17:31:43.925  10912-10924/? W/dalvikvm﹕ threadid=10: thread exiting with uncaught exception (group=0x40aa1228)
10-11 17:31:43.935  10912-10924/? E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-848
        java.lang.NullPointerException
        at com.android.camera.CameraThread.start_video_recording(CameraThread.java:2872)
        at com.android.camera.CameraThread$MainHandler.handleMessage(CameraThread.java:1069)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:154)
        at com.android.camera.CameraThread.run(CameraThread.java:3217)
10-11 17:31:43.945     239-1184/? E/EmbeddedLogger﹕ App crashed! Process: com.android.camera
10-11 17:31:43.945     239-1184/? E/EmbeddedLogger﹕ App crashed! Package: com.android.camera v400426164 (4.0.2217372550.426164)
10-11 17:31:43.945     239-1184/? E/EmbeddedLogger﹕ Application Label: Camera

0 个答案:

没有答案