mediarecorder

In Android, is it possible to change Camera (from front to back) and still keep recording?

不问归期 提交于 2020-01-19 11:15:08
问题 That's my question :). If I start recording using the Front Camera with the MediaRecorder and then switch to the back camera, is it possible to keep recording using the same video file? Also, is it possible to record both cameras at the same time? 回答1: You can do it on Nexus9 with camera2 api. (Nexus5 can't open 2 cameras at the same time) Create 2 Gl contexts(Shared) and 2 texture buffers. Create a TextureView for previewing. Create a MediaRecoder for recording. Open front and back camera.

In Android, is it possible to change Camera (from front to back) and still keep recording?

我们两清 提交于 2020-01-19 11:14:42
问题 That's my question :). If I start recording using the Front Camera with the MediaRecorder and then switch to the back camera, is it possible to keep recording using the same video file? Also, is it possible to record both cameras at the same time? 回答1: You can do it on Nexus9 with camera2 api. (Nexus5 can't open 2 cameras at the same time) Create 2 Gl contexts(Shared) and 2 texture buffers. Create a TextureView for previewing. Create a MediaRecoder for recording. Open front and back camera.

In Android, is it possible to change Camera (from front to back) and still keep recording?

我的梦境 提交于 2020-01-19 11:14:02
问题 That's my question :). If I start recording using the Front Camera with the MediaRecorder and then switch to the back camera, is it possible to keep recording using the same video file? Also, is it possible to record both cameras at the same time? 回答1: You can do it on Nexus9 with camera2 api. (Nexus5 can't open 2 cameras at the same time) Create 2 Gl contexts(Shared) and 2 texture buffers. Create a TextureView for previewing. Create a MediaRecoder for recording. Open front and back camera.

Android 录音和播放

折月煮酒 提交于 2020-01-15 04:02:00
  今天工作上需要做一个一边录音一边播放的功能,大致原因是有一个外部设备输入音频到我们机器,然后我们机器需要马上把音频播放出来。所以了解了一些有关录音和播放的知识。接到这个任务的第一反应就是看看Android源码里面的录音Demo,因此今天针对Android的录音demo程序讲解一些录音和播放相关知识。   今天主要讲解一下使用MediaRecorder 实现录音,主要是参照Android官网介绍来说明。   今天讲的并不能实现一边录音一边播放,下一篇文章我再说如何解决这问题。下面是我们今天要讲解的Mediarecorder的状态机图。摘录自Android官网。 (PS:新建的QQ群,有兴趣可以加入一起讨论:Android群:322599434) 1、使用Mediarecorder 录音   MediaRecorder类用来进行媒体采样,包括音频和视频。也就是用来记录音频和视频方法的类,记录的数据一般都是写入到文件里面。因此我们可以通过这个类实现录音和录视频的功能。下面介绍MediaRecorder用来录音的简单方法: //Edited by mythou//http://www.cnblogs.com/mythou/ MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource

vue+webRTC对webRTC基本api测试demo

眉间皱痕 提交于 2020-01-13 05:22:35
webRTC基本功能测试demo video.vue代码 <template> <div class="video"> <h2>基本api测试</h2> <div class="video__partner"> <div> <label>audio Source</label> <select id="audioSource"> <option :value="item.value" v-for="(item,index) in audioSourceOption" :key="index">{{item.text}}</option> </select> </div> <div> <label>audio output device</label> <select id="audioOutput"> <option :value="item.value" v-for="(item,index) in audioOutputOption" :key="index">{{item.text}}</option> </select> </div> <!-- <div> <label>audio input device</label> <select id="audioInput"> </select> </div> --> <div> <label>video Source<

How to change framerate when using MediaRecorder Class

强颜欢笑 提交于 2020-01-12 05:21:46
问题 I try to record video using MediaRecorder Class. However I find out that I failed to lower the framerate of the video stream. I'm using H.264 as my Video Encoder and AAC as my Audio Encoder(yes, it is supported in API LEVEL 10 and above, AKA Android 2.3.3+) The main source is as follows. recorder = new MediaRecorder(); recorder.setPreviewDisplay(surfaceHolder.getSurface()); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); //set

Android mediarecorder stop failed

自闭症网瘾萝莉.ら 提交于 2020-01-11 08:11:08
问题 I've faced a very strange behavior: sometimes my mediarecorder crashes with an error "Stop failed" and sometimes it works fine. Is there my fault or it is a bug of the system? I cant't get what is wrong. private void stopRecording(){ ticker.cancel(); ticker.purge(); recorder.stop(); startBtn.setText("Start"); recordInProcess = false; markList = locWriteTask.getMarkArray(); mCamera.lock(); recorder.release(); } private void startRecording(){ startBtn.setText("Stop"); recordInProcess = true;

Video recording and onPreviewFrame callback at the same time

落花浮王杯 提交于 2020-01-10 04:34:10
问题 I'm trying to record video using MediaRecorder and get raw frames (byte arrays) from onPreviewFrame callback method Seems it's not that easy, mb it's not even possible, I don't know... But I found some answers (for similar questions) and people say that you should reconnect camera instance ( Camera.reconnect() ) after calling MediaRecorder.start() and set preview callback again I tried something like this but it doesn't work (recording works but onPreviewFrame is never called) I also tried to

How to save an audio file in internal storage android

China☆狼群 提交于 2020-01-06 17:09:46
问题 I was wondering how can I save an audio file in the Internal storage of my android device. Specifically I would like my app that records sound from the microphone to save this file in the internal storage. I know that for external storage there is something like: outputFile = Environment.getExternalStorageDirectory()+"/myrecord.3gpp"; Is there anything similar for internal storage also? Thanks! 回答1: Use getFilesDir() SDCardpath = getFilesDir(); myDataPath = new File(SDCardpath.getAbsolutePath

How to save an audio file in internal storage android

荒凉一梦 提交于 2020-01-06 17:09:25
问题 I was wondering how can I save an audio file in the Internal storage of my android device. Specifically I would like my app that records sound from the microphone to save this file in the internal storage. I know that for external storage there is something like: outputFile = Environment.getExternalStorageDirectory()+"/myrecord.3gpp"; Is there anything similar for internal storage also? Thanks! 回答1: Use getFilesDir() SDCardpath = getFilesDir(); myDataPath = new File(SDCardpath.getAbsolutePath