Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

Overview

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.svg) ![](https://img.shields.io/crates/l/rustc-serialize.svg) ![](https://img.shields.io/badge/version-1.0.0-blue.svg)

Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

You can report any issue on issues page. Note: If you speak Arabic, you can submit issues with Arabic language and I will check them. :)

mediarecorderdialog

Installation


Maven

<dependency>
<groupId>net.alhazmy13.MediaRecorderDialog</groupId>
<artifactId>libary</artifactId>
<version>1.0.0</version>
</dependency>

Gradle

dependencies {
	compile 'net.alhazmy13.MediaRecorderDialog:libary:1.0.0'
}

Usage


 new MediaRecorderDialog.Builder(MainActivity.this)
    .setOutputFormat(MediaRecorderDialog.OutputFormat.MPEG_4)
    .setAudioEncoder(MediaRecorderDialog.AudioEncoder.AAC)
    .setTitle("Recording,,,")
    .setMessage("Press the button")
    .setOnSaveButtonClickListener(new OnSaveButtonClickListener() {
        @Override
        public void onSucceed(String path) {
            // Toast.makeText(MainActivity.this,path,Toast.LENGTH_SHORT).show();
        }
        @Override
        public void onFailure() {
            //Toast.makeText(MainActivity.this,"Failure",Toast.LENGTH_SHORT).show();
        }
    })
    .show();

Implement an OnSaveButtonClickListener

In order to receive the path of file, you will need to implement the OnSaveButtonClickListener interfaces.

    @Override
    public void onSucceed(String path) {
        //Your Code
    }
    @Override
    public void onFailure() {
        //Your Code
    }

Additional Options

  • setTitle You can change the title of Dialog
.setTitle("Recording,,,")
  • setMessage to change the message
.setMessage("Press the button")
  • setOutputFormat You can change the Output format by passing the format from MediaRecorderDialog.OutputFormat
.setOutputFormat(MediaRecorderDialog.OutputFormat.MPEG_4)
  • setAudioEncoder You can change the Encoder by passing the value from MediaRecorderDialog.AudioEncoder
.setAudioEncoder(MediaRecorderDialog.AudioEncoder.AAC)

Theme and style

You can theme the dialog by overwriting the color resources in your project.

    <color name="media_recorder_colorPrimary">#00796B</color>
    <color name="media_recorder_background">#009688</color>
    <color name="media_recorder_bar">#80CBC4</color>

Credits

License


Copyright (c) 2016 Abdullah Alhazmy

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Chat App is built to demonstrate a simple end-to-end chat encryption using RSA and AES algorithms
Chat App is built to demonstrate a simple end-to-end chat encryption using RSA and AES algorithms

End-to-End Encrypted Chat 🔒 Chat App is built to demonstrate a simple end-to-end chat encryption using RSA and AES algorithms Built With ⚒️ Jetpack C

Jetchat is a sample chat app built with Jetpack Compose.
Jetchat is a sample chat app built with Jetpack Compose.

Jetchat sample Jetchat is a sample chat app built with Jetpack Compose. To try out this sample app, you need to use Android Studio Arctic Fox You can

Talkufy brings you everything you need. From chatting, video calling (Beta), translating messages, group chats and lots more.
Talkufy brings you everything you need. From chatting, video calling (Beta), translating messages, group chats and lots more.

Talkufy A highly advanced and encrypted open source featured chat/video calling app for android using Firebase Firestore and Jitsi Meet. With this app

This command line program can extract chat messages send on the Minecraft server HGLabor

HGLabor-Log-Extractor Das Programm durchläuft einmalig deine Minecraft-Logs und sammelt alle Nachrichten heraus, die auf HGLabor geschrieben wurden. K

Notification - Notifications provide short, timely information about events in your app while it's not in use

Notification ⭐ Notifications provide short, timely information about events in y

Messaging API: Connect to PostgreSQL and Kafka to obtain and manage cars inventory

Messaging-API In this simple API, we connect to PostgreSQL and Kafka to obtain a

Open Source Messenger App For Android - Real-time Messaging, Voice and Video Calls

Open Source Messenger App For Android - Real-time Messaging, Voice and Video Calls

A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.
A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

 AvengersChat is a demo application based on modern Android tech stacks and Stream Chat SDK.
AvengersChat is a demo application based on modern Android tech stacks and Stream Chat SDK.

💙 Android sample Avengers chat application using Stream Chat SDK based on MVVM (ViewModel, Coroutines, Room, Hilt, Repository) architecture.

Comments
  • App is crashing!

    App is crashing!

    App is crashing while calling the MediaRecorderDialog. The reason of crashing is apparently the non-inflation of FloatingActionButton. But I am unable to find, as everything is fine. The library is there, it is linked as well. Can you figure out the root cause of this issue?

    Here is the crash log: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mowe.complain/net.alhazmy13.gota.GotaActivity}: android.view.InflateException: Binary XML file line #50: Error inflating class android.support.design.widget.FloatingActionButton at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2689) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754) at android.app.ActivityThread.access$900(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5938) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

    help wanted 
    opened by yasirtahir 4
  • Error Record

    Error Record

    Fatal Exception: java.lang.IllegalStateException at android.media.MediaRecorder.start(MediaRecorder.java) at net.alhazmy13.mediarecorderdialog.SoundDialog.onSecondaryViewAppeared(SoundDialog.java:288) at com.truizlop.fabreveallayout.FABRevealLayout.notifyListener(FABRevealLayout.java:295) at com.truizlop.fabreveallayout.FABRevealLayout.swapViews(FABRevealLayout.java:287) at com.truizlop.fabreveallayout.FABRevealLayout.access$300(FABRevealLayout.java:36) at com.truizlop.fabreveallayout.FABRevealLayout$3.onAnimationEnd(FABRevealLayout.java:229) at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:552) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1209) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1449) at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146) at android.animation.AnimationHandler.-wrap2(Unknown Source) at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909) at android.view.Choreographer.doCallbacks(Choreographer.java:723) at android.view.Choreographer.doFrame(Choreographer.java:655) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

    opened by yaserNKM 0
  • التطبيق يغلق بعد الضغط على الزر عند دمجه بالتطبيق و عند تجربة المثال هذا ما يطلع

    التطبيق يغلق بعد الضغط على الزر عند دمجه بالتطبيق و عند تجربة المثال هذا ما يطلع

    03-28 13:43:35.034 2541-2561/net.alhazmy13.mediarecorderdialog E/Surface: getSlotFromBufferLocked: unknown buffer: 0xac1238f0 03-28 13:43:38.564 2541-2541/net.alhazmy13.mediarecorderdialog E/MediaRecorder: start called in an invalid state: 4 03-28 13:43:38.565 2541-2541/net.alhazmy13.mediarecorderdialog E/AndroidRuntime: FATAL EXCEPTION: main Process: net.alhazmy13.mediarecorderdialog, PID: 2541 java.lang.IllegalStateException at android.media.MediaRecorder.start(Native Method) at net.alhazmy13.mediarecorderdialog.SoundDialog.onSecondaryViewAppeared(SoundDialog.java:197) at com.truizlop.fabreveallayout.FABRevealLayout.notifyListener(FABRevealLayout.java:295) at com.truizlop.fabreveallayout.FABRevealLayout.swapViews(FABRevealLayout.java:287) at com.truizlop.fabreveallayout.FABRevealLayout.access$300(FABRevealLayout.java:36) at com.truizlop.fabreveallayout.FABRevealLayout$3.onAnimationEnd(FABRevealLayout.java:229) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239) at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)

           at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
                                                                                     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                                                     at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                                     at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                                                     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                                     at android.os.Handler.handleCallback(Handler.java:739)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                     at android.os.Looper.loop(Looper.java:148)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    
    opened by trikiano 0
Releases(1.0.0)
Owner
Abdullah Alhazmy
Addicted to learning | Sr. Software engineer | Founder @xpend | Co-Founder @Gwork-projects & @EmaanHq
Abdullah Alhazmy
A simple video calling application uses Firebase database and WebRTC API that enables you Peer-to-Peer Full-HD video and audio connection.

A simple video calling application uses Firebase database and WebRTC API that enables you Peer-to-Peer Full-HD video and audio connection.

Indrajit Sahu 10 Sep 27, 2022
Android Combined Application for chat, audio/video calls, and broadcast to millions of web and app users using VdoTok SDK.

Android Combined Application for chat, audio/video calls, and broadcast to millions of web and app users using VdoTok SDK.

VdoTok 3 Nov 22, 2022
An instant messaging and audio-video calling app

Babble Babble is a chatting and calling application for anyone with an Android phone and an Internet connection. Just sign up using your phone number

Anubhav Chachra 3 Oct 9, 2022
A tool for making your stay through "IC" a little better.

mr.r0bot-kt.v Mr.r0bot-kt.v is tool that handles computer logic calculations and provides a better experience through your stay at "IC". Warning Use m

null 5 Dec 7, 2021
Chat with anyone you like through the power of chatcom.

Chat with anyone you like through the power of chatcom. This app provides End-To-End Encryption so that the word doesn't leak out.

Puranjay Savar Mattas 1 Jan 25, 2022
A private-chat-only Android App for Secure Scuttlebutt

Tremola README Tremola is a Secure Scuttlebutt (SSB) client for Android that only supports private chat. Tremola aims at having the same functionality

Computer Networks Group 29 Oct 30, 2022
This is a Bluetooth operational Chat-App developed using Kotlin which shows the list of available devices nearby and paired devices, upon clicking you can start chat

This is a Bluetooth operational Chat-App developed using Kotlin which shows the list of available devices nearby and paired devices, upon clicking you can start chat ... VOILA ???? It is still in its early stages of development and currently let user to one-time chat at a time. It is under heavy development ??

Shalu Ambasta 3 Jan 10, 2022
Quick Text is about send the message on WhatsApp without saving number. You can see the status of other and share and download those status also.

Quick Text is about send the message on WhatsApp without saving number. You can see the status of other and share and download those status also.

Dheeraj Gupta 11 May 25, 2022
TwitchControlsMinecraft - A mod that lets your twitch chat let things happen in your game on a specific event

Twitch Controls Minecraft A mod that lets your Twitch chat lets your twitch chat

Marcel Böcker 2 Oct 13, 2022
Qiscus provide everything you need to power up your app with chats. And it's now made simple.

Introduction Qiscus Chat SDK (Software Development Kit) is a product provided by Qiscus that enables you to embed an in-app chat/chat feature in your

Qiscus - Multichannel Conversational Platform 197 Dec 27, 2022