Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

31
LINES

< > BotCompany Repo | #1000865 // MediaRecorder Test (Android)

JavaX source code (Android) [tags: use-pretranspiled] - run with: the app

Libraryless. Click here for Pure Java version (78L/1K/3K).

!747

import android.media.*;

m {
  static Object androidContext;
  
  p {
    print("Making MediaRecorder.");
    String outputPath = "/storage/sdcard0/JavaX-Record/bla.3gpp";
    mkdirsForFile(new File(outputPath));
    print("Recording to: " + outputPath);
    
    MediaRecorder recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setOutputFile(outputPath);
    recorder.prepare();
    recorder.start();   // Recording is now started
    print("Recording.");
    sleep(5000);
    recorder.stop();
    print("Stopped recording.");
    recorder.reset();   // You can reuse the object by going back to setAudioSource() step
    recorder.release();
    
    long len = new File(outputPath).length();
    print("File size: " + len);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
1073 stefan Works like a charm! 2015-08-31 00:48:15

add comment

Snippet ID: #1000865
Snippet name: MediaRecorder Test (Android)
Eternal ID of this version: #1000865/1
Text MD5: 87ee65dfed8f1a249b0da893978d9d8d
Transpilation MD5: 9b5c8f20e1db779249471aac4ea61708
Author: stefan
Category: javax
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-31 00:48:23
Source code size: 954 bytes / 31 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1030 / 970
Referenced in: #3000189 - Answer for stefanreich(>> t bla)
#3000382 - Answer for ferdie (>> t = 1, f = 0)