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

flixel-gdx is an open source 2D game engine written in Java. Flixel-gdx is a port of AS3 flixel. It is built on top of the powerful libgdx framework which allows developers to build and distribute cross-platform games.

Fast JSON parser for Java projects. The following scalar types are supported:

  • String
  • boolean/Boolean
  • int/Integer
  • long/Long
  • float/Float
  • double/Double

If a json field is another dictionary, it can be represented by another model class. That model class must also have the @JsonType annotation.

Lists of objects are supported either as Java Lists or Queues.

Mimicry is a tiny Android library (actually just one class) to format items in a ListAdapter to display as a grid.

Why not just use a GridView? Because a MimicryAdapter can be used with other ListAdapters!

Encryption is a simple way to create encrypted strings to Android project.

SnappyDB is a key-value database for Android it's an alternative for SQLite if you want to use a NoSQL approach.

It allows you to store and get primitive types, but also a Serializable object or array in a type-safe way.

SnappyDB can outperform SQLite in read/write operations.

AppRate for Android is a library that allows your users to rate your application in a non intrusive way. A window with options to rate, remind later or reject is displayed according to your configuration

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