An Android library to make the implementation of voice/audio messages' playing easier

Overview

AppVeyor GitHub language count CodeFactor Grade GitHub code size in bytes GitHub JitPack GitHub commit activity GitHub Release Date





ChatVoicePlayer

An Android library to make the implementation of voice/audio messages' playing easier

Why to use this library?

  • To avoid the unwanted errors of using MediaPlayer in Android
  • This is a ready-to-use component to use in playing the chat voice messages in chat applications or any other app
  • Easy to use WaveForm for the played sounds

Features

  • Extremely easy to use
  • Direct share of the audio file
  • Full control of customization (colors, visibilities, shapes)
  • The controls are availabe in XML and programmatically
  • WaveForm Seekbar

Installation

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.JagarYousef:ChatVoicePlayer:$LATEST'
}

Usage

  1. Add the voice player view in your xml layout:
<me.jagar.chatvoiceplayerlibrary.VoicePlayerView
    android:id="@+id/voicePlayerView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:enableVisualizer="true"
    app:visualizationPlayedColor="#ff7700"
    app:visualizationNotPlayedColor="#727171"
    app:playPauseBackgroundColor="#ff7700"
    app:timingBackgroundColor="#6AFF7700"
    app:seekBarProgressColor="#000"
    app:showShareButton="true"
    app:shareCornerRadius="100"
    app:playPauseCornerRadius="100"
    app:showTiming="true"
    app:viewCornerRadius="100"
    app:viewBackground="#C6C4CF"
    app:progressTimeColor="#000"
    app:seekBarThumbColor="#FFC107"
    app:shareBackgroundColor="#ff7700"
    app:playProgressbarColor="#ff7700"
    app:shareText="SHARE ME"/>
  1. Now prepare your player view wherever you want in your activity:
voicePlayerView.setAudio(AUDIO_FILE_PATH);
  • NOTE: Make sure to allow READ & WRITE external storage permessions

Supported functions

onStop() //This will avoid many errors if you called it on your activity onStrop()
onPause() //If you don't want to play the voice out of your activity/app!
setViewBackgroundShape(int color, float radius) //color should be R.color.YOUR_COLOR
setShareBackgroundShape(int color, float radius) //color should be R.color.YOUR_COLOR
setPlayPaueseBackgroundShape(int color, float radius) //color should be R.color.YOUR_COLOR
setSeekBarStyle(int progressColor, int thumbColor) //both colors should be R.color.YOUR_COLOR
setTimingVisibility(boolean visibility)
setShareButtonVisibility(boolean visibility)
setShareText(String shareText)
showPlayProgressbar()
hidePlayProgressbar()
refreshPlayer(String audioPath)

License

MIT License

Copyright (c) 2019 Jagar Yousef

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.
Comments
  • ChatVoicePlayer continuously calling custom method once play is pressed

    ChatVoicePlayer continuously calling custom method once play is pressed

    I've integrated ChatVoicePlayer into a chat recycler view.

    I have a method that checks the content in each recycler view item to be able to handle it in a specific way. However, any item that contains the ChatVoicePlayer calls this method continuously once play is pressed, and even after paused, or even the activity closed.

    Is there anything under the hood of the ChatVoicePlayer that could be triggering this?

    opened by ChrisLMills 7
  • Progress bar stopped showing

    Progress bar stopped showing

    I have implemented the ChatVoicePlayer successfully. At first I could see the progress bar, then I couldn't. I didn't make changes to the XML. Any idea what could be causing this?

    To add, it still works, I can move it up and down, and I can also see the click animation on it.

    opened by ChrisLMills 3
  • question about main thread issue

    question about main thread issue

    hi, i see you using stream in FileUtils

    public static byte[] fileToBytes(File file) {
            int size = (int) file.length();
            byte[] bytes = new byte[size];
            try {
                BufferedInputStream buf = new BufferedInputStream(new FileInputStream(file));
                buf.read(bytes, 0, bytes.length);
                buf.close();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return bytes;
        }
    

    i want to ask if I using url from network, and my recyclerview have many voice, so did it block main thread and cause delay? Thanks

    opened by fukemy 2
  • ChatVoicePlayer requires this function

    ChatVoicePlayer requires this function

    ChatVoicePlayer lacks an important functionality of limiting the record time.

    • [ ] A new function should be created which allows to provide the record time limit until which to record and then automatically calls the onFinish function of onRecordListener.
    opened by irtza46 1
  • Anyone tell me, how can i Audio Play and Pause using Programing (Java code)

    Anyone tell me, how can i Audio Play and Pause using Programing (Java code)

    Anyone tell me, how can i Audio Play and Pause using Programing (Java code) I have 20 audio files in Recyclerview, but 2 audio play together anyone tell me

    opened by GovindHiteshi 0
  • ChatVoicePlayer lacks an important functionality

    ChatVoicePlayer lacks an important functionality

    ChatVoicePlayer lacks an important functionality of limiting the record time. A new function should be created which allows to provide the record time limit until which to record and then automatically calls the onFinish function of onRecordListener.

    opened by irtza46 0
  • RecycleView is Lagging

    RecycleView is Lagging

    Recylcerview is lagging as you put more and more ChatVoicePlayer objects in it. that is already reported, but still it is there. Thanks for the great stuff.

    opened by umer-sufyan 2
  • can't use   setImgPauseClickListener and  setImgPlayClickListener

    can't use setImgPauseClickListener and setImgPlayClickListener

    i can't use it setImgPauseClickListener and setImgPlayClickListener when i click it not happing anything

       ```
     holder.voicePlayerView.setImgPauseClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.d(TAG, "onClick: pausiiiiiii");
                }
            });
    
            holder.voicePlayerView.setImgPlayClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.d(TAG, "onClick: playyyyyyed");
    
                    Log.d(TAG, "onClick: message : "+mss.getMessage());
                    
                }
            });
    
    I want to play only 1 audio by one not all in the same time because now I can run all audio players in the same time that is not good I want to run audio 1 and the other audio player paused so I need these features so response me too fast thanks 
    opened by ibrelm 0
  • Audio Play on press of setImgPlayClickListener  this function

    Audio Play on press of setImgPlayClickListener this function

    How can I play audio ,when i calling this function anyone help me

    holder.voicePlayerView.setImgPlayClickListener {

                Log.e("TAG", "onBindViewHolder: Play Audio")
    
    
            }
    
    opened by GovindHiteshi 0
  • app:enableVisualizer=

    app:enableVisualizer="true" doesn't work.

    Hello, I have an issue with Visualizer. When I set app:enableVisualizer="false" progress bar is shown up, but when I set app:showShareButton="true" the recordview is looking like this: Capture

    How can I solve this issue?

    opened by Achisyg 11
  • Callback listner when we click on play or pause button

    Callback listner when we click on play or pause button

    hey brother! i have a question regarding callbacks. is there any callback when we tap on play button or pause button? i want to perform some action on these button

    opened by muhammadanas759 4
Releases(1.1.0)
Owner
Jagar
Just another geek
Jagar
Fork of kord, mainly used for Voice

Kord Kord is still in an experimental stage, as such we can't guarantee API stability between releases. While we'd love for you to try out our library

Mixtape OSS 4 Jun 7, 2022
Open-sourced voice labeling application

vLabeler vLabeler is an open-sourced voice labeling application, aiming: Modern and fluent UI/UX Customizable labeling/import/export, to be used by di

null 42 Dec 23, 2022
:sound: [Android Library] Easily generate pure audio tone of any frequency in android

Android library to easily generate audio tone in android. Generating pure tone of an specific frequency was never that easy. ZenTone does all the heav

Nishant Srivastava 102 Dec 19, 2022
Audio Tagger library for Flutter (Android only)

audio_tagger A Flutter (Android only) plugin for editing and extracting information from your music, at the moment it only works on AAC and OGG (last

SongTube 3 Apr 15, 2022
Silky - Android application to convert videos from applications such as YouTube, Facebook, Twitter into audio (.mp3)

Silky EspaƱol (actualmente la app se encuentra en desarrollo ) Descripcion Aplic

null 2 Aug 24, 2022
Video/Audio Downloader for Android, written with Jetpack Compose.

Seal Video/Audio Downloader for Android, written with Jetpack Compose.

junkfood 2.1k Dec 29, 2022
A fork of audio-analyzer-for-android in Google code, with a lot of enhancement.

Audio Spectrum Analyzer for Android A fork of Audio spectrum Analyzer for Android (See README.old for its original readme) This software shows the fre

null 74 Jan 1, 2023
A radio player mobile application which streams audio from Radio Sai Global Harmony.

A radio player mobile application which streams audio from Radio Sai Global Harmony.

Sai Rajendra Immadi 11 Nov 26, 2022
Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface.

Fermata Media Player About Fermata Media Player is a free, open source audio and video player with a simple and intuitive interface. It is focused on

Andrey 227 Jan 6, 2023
Radio Player - A Flutter plugin to play streaming audio content with background support and lock screen controls.

A Flutter plugin to play streaming audio content with background support and lock screen controls. Installation To use this package, add

Ayotunde abdulsalam 1 Mar 14, 2022
A simple app showing how to make a YouTube Shorts/TikTok style video pager

It's pretty straightforward to get started using ExoPlayer by following the library's Hello world! documentation. Once you throw Android's lifecycles

Nick 83 Jan 4, 2023
An app showing how to make an Instagram/YouTube Shorts/TikTok style video pager

It's pretty straightforward to get started using ExoPlayer by following the library's Hello world! documentation. Once you throw Android's lifecycles

Nick 84 Dec 21, 2022
An Lavalink documentation version made for replit and glitch users to make discord music bots.

LavaCord An Lavalink documentation version made for replit and glitch users to make discord music bots. Being used in production by Alpha Esports bots

Astroicy 3 Nov 1, 2022
VideoTimelineView - A TimelineView implementation for video cut and trim operation

VideoTimelineView A TimelineView implementation for video cut and trim operation

null 2 Jun 23, 2022
An easy to use Instagram Video Downloader library for android apps.

Instagram-Video-Downloader-Library An easy to use library for directly download videos from ig reels, igtv. Implementation Step 1. Add the JitPack rep

Abhay 16 Dec 7, 2022
Library for Instagram Image/Video Downloader for Android

Insta Downloader Simple Instagram Image Video Downloader Library for Android Implementation Step 1. Add the JitPack repository to your build file Add

kannikesh Prabhu 2 Mar 12, 2022
The official Android client library for api.video

api.video Android client api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing

api.video 7 Dec 3, 2022
ZExoRecyclerPlayer is an Android library that allows developers to easily create RecyclerView with Exoplayer .

ZExoRecyclerPlayer Description ZExoRecyclerPlayer is an Android library that allows developers to easily create RecyclerView with Exoplayer . Please f

mohammed alzoubi 4 Dec 12, 2022