404: Something's gone wrong :-(
59 | 60 |You've tried to visit a page that doesn't exist. Luckily this site 62 | has other pages.
63 |If you were looking for something specific, try searching: 64 |
67 | 68 | 69 |You've tried to visit a page that doesn't exist. Luckily this site 62 | has other pages.
63 |If you were looking for something specific, try searching: 64 |
67 | 68 | 69 |For help getting started with Flutter, view our online 69 | documentation.
70 |For help on editing plugin code, view the documentation.
71 |With the medcorder_audio plugin you can integrate record/play audio support into your flutter app for iOS or Android.
72 |Future
75 | iOS only. open PlayAndRecord audio session
76 | returns: 'OK', 'FAIL'
Future
79 | iOS only. close PlayAndRecord audio session
80 | returns: 'OK', 'FAIL'
Future
83 | start record audio file to app documents path
84 | returns: 'OK', 'FAIL'
Future
87 | stop audio recording process
88 | returns: 'OK', 'FAIL'
Future
91 | check if you have recording audio permissions
92 | returns: 'OK', 'NO'
Future
95 | start audio playing for file with position
96 | returns: 'OK', 'FAIL'
97 | params: Map<String, String>
Key | Type | Description |
---|---|---|
file | String | String file Id |
position | double | play start position in seconds |
Future
101 | stop audio playing
102 | returns: 'OK', 'FAIL'\
for receiving plugin events you need assign callback function
105 | void _onEvent(dynamic event) {...}
Key | Type | Description |
---|---|---|
'code' | String | 'recording', |
'url' | String | recording file url |
'peakPowerForChannel' | double | peak power for channel |
'currentTime' | double | recording time in seconds |
Key | Type | Description |
---|---|---|
'code' | String | 'playing', 'audioPlayerDidFinishPlaying' |
'url' | String | playing file url |
'currentTime' | double | playing time in seconds |
'duration' | double | playing file duration |
const EventChannel('medcorder_audio_events')
244 | const MethodChannel('medcorder_audio')
255 | MedcorderAudio() {
106 | eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError);
107 | }
108 | Future<String> backAudioSettings() async {
107 | try {
108 | final String result = await platform.invokeMethod('backAudioSettings');
109 | print('backAudioSettings: ' + result);
110 | return result;
111 | } catch (e) {
112 | print('backAudioSettings: fail');
113 | return 'fail';
114 | }
115 | }
116 | dynamic callback;
105 |
106 |
107 | Future<String> checkMicrophonePermissions() async {
107 | try {
108 | final String result =
109 | await platform.invokeMethod('checkMicrophonePermissions');
110 | print('stopPlay: ' + result);
111 | return result;
112 | } catch (e) {
113 | print('stopPlay: fail');
114 | return 'fail';
115 | }
116 | }
117 | static const EventChannel eventChannel =
105 | const EventChannel('medcorder_audio_events');
106 |
107 |
108 | static const MethodChannel platform = const MethodChannel('medcorder_audio');
105 |
106 |
107 | Future<String> setAudioSettings() async {
107 | try {
108 | final String result = await platform.invokeMethod('setAudioSettings');
109 | print('setAudioSettings: ' + result);
110 | return result;
111 | } catch (e) {
112 | print('setAudioSettings: fail');
113 | return 'fail';
114 | }
115 | }
116 | void setCallBack(dynamic _callback) {
108 | callback = _callback;
109 | }
110 | Future<String> startPlay(dynamic params) async {
108 | try {
109 | final String result = await platform.invokeMethod('startPlay', params);
110 | print('startPlay: ' + result);
111 | return result;
112 | } catch (e) {
113 | print('startPlay: fail');
114 | return 'fail';
115 | }
116 | }
117 | Future<String> startRecord(String file) async {
108 | try {
109 | final String result = await platform.invokeMethod('startRecord', file);
110 | print('startRecord: ' + result);
111 | return result;
112 | } catch (e) {
113 | print('startRecord: fail');
114 | return 'fail';
115 | }
116 | }
117 | Future<String> stopPlay() async {
107 | try {
108 | final String result = await platform.invokeMethod('stopPlay');
109 | print('stopPlay: ' + result);
110 | return result;
111 | } catch (e) {
112 | print('stopPlay: fail');
113 | return 'fail';
114 | }
115 | }
116 | Future<String> stopRecord() async {
107 | try {
108 | final String result = await platform.invokeMethod('stopRecord');
109 | print('stopRecord: ' + result);
110 | return result;
111 | } catch (e) {
112 | print('stopRecord: fail');
113 | return 'fail';
114 | }
115 | }
116 |