sc-PlayerButton


Source link: https://github.com/Paroca72/sc-player

sc-PlayerButton

Create a simple button than play a media source.
The basic function are simple a Play/Stop on pressing the button. The button will show the wave-form on playing the media.

IMPORTANT
For showing the wave form require the RECORD_AUDIO permission.
If not, will show a PLAY/STOP simple icon and NOT will show the wave form.


This class inherit from the android View class.
So for example if you would change the background is enough to use the android:background property. For customize the component please read guide below.

Public methods

  • int getDuration()
    Get back the media duration.

  • boolean isPlaying()
    Get the media playing status.

  • void play()
    Start to play the current media

  • void stop()
    Stop to play the current media

  • void setOnEventListener(OnEventListener listener)
    Set the event listener.


Getter and Setter

  • get/setSource -> String value, default null
    Set the current media source (absolute path).

  • get/setColor -> Color value, default #FFFFFF
    Set the current foreground color.

  • get/setFontSize -> float value, default 11dp
    Set the current font size.

  • get/setVolume -> float value, default 0.7
    Set the current media player volume (0..1).

  • get/setPosition -> int value, default 0
    Set the current media player position.


Interfaces

  • OnEventListener
    void onStartPlay(MediaPlayer player);
    Called when the media start to play.
    void onStopPlay();
    Called when the media stop to play.


XML Properties

<declare-styleable name="ScPlayerButton">
  <attr name="source" format="string" />
  <attr name="color" format="color" />
  <attr name="fontSize" format="dimension" />
  <attr name="volume" format="float" /> </declare-styleable>

Usage

via Gradle:
Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {

...
maven {
 url "https://jitpack.io" 
}
  
}
 
}

Add the dependency

dependencies {

  ...
  compile 'com.github.paroca72:sc-player:1.0.2' 
}

Coding

// Get the components ScPlayerButton player = (ScPlayerButton) this.findViewById(R.id.player);
 assert player != null;  // Play the default ringtone Uri defaultRintoneUri = RingtoneManager

.getActualDefaultRingtoneUri(this.getApplicationContext(), RingtoneManager.TYPE_RINGTONE);
 player.setSource(defaultRintoneUri.toString());


License

 Copyright 2015 Samuele Carassai
Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in  writing, software  distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,  either express or implied.  See the License for the specific language governing permissions and  limitations under the License. 

Resources

RxAnimation is animation event wrapping observable.

You can get android animation event observable. And you can call animation chain and combination more simple.

A simple tool that makes it more convenient to install, uninstall and creating bug reports and more for multiple apps on multiple devices with one command. Additionally uninstalling allows to use wildcards as package name. This is basically a front-end for the Android Debug Bridge (ADB) which is required to run.

A tool that helps signing and zip aligning single or multiple Android application packages (APKs) with either debug or provided release certificates. It supports v1 and v2 Android signing scheme has embedded a debug keystore and auto verifies after signing.

Vidsta is a simple and easy to use video player, with customisable options for seamless integration. It's very lightweight, and features listeners for most possible events.

A sample app is also available.

Fast and simple Planning Poker Android app. Designed for phones, tablets and Android Wear devices.

A floating text button component.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes