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).

1  
!747
2  
3  
import android.media.*;
4  
5  
m {
6  
  static Object androidContext;
7  
  
8  
  p {
9  
    print("Making MediaRecorder.");
10  
    String outputPath = "/storage/sdcard0/JavaX-Record/bla.3gpp";
11  
    mkdirsForFile(new File(outputPath));
12  
    print("Recording to: " + outputPath);
13  
    
14  
    MediaRecorder recorder = new MediaRecorder();
15  
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
16  
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
17  
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
18  
    recorder.setOutputFile(outputPath);
19  
    recorder.prepare();
20  
    recorder.start();   // Recording is now started
21  
    print("Recording.");
22  
    sleep(5000);
23  
    recorder.stop();
24  
    print("Stopped recording.");
25  
    recorder.reset();   // You can reuse the object by going back to setAudioSource() step
26  
    recorder.release();
27  
    
28  
    long len = new File(outputPath).length();
29  
    print("File size: " + len);
30  
  }
31  
}

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: 1031 / 971
Referenced in: [show references]