GithubHelp home page GithubHelp logo

waveinapp's People

Contributors

codekidx avatar ilchenko-peter avatar iojjj avatar jekaua avatar ponomarenko-cr avatar vadimhalimendikcr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

waveinapp's Issues

Cannot initialise visualizer engine, error -3

First of all thanks for providing this library, it looks great.

Only thing is, I’m having a problem where I run into the following error:

java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3

The error is triggered at the following line:

VisualizerDbmHandler vizualizerHandler
= DbmHandler.Factory
.newVisualizerHandler(
PlayActivity.this,
state.getExtras().getInt(StreamingService.AUDIO_SESSION_ID)
);

The AUDIO_SESSION_ID is provided by an ExoPlayer instance in a background service, though it seems the value it is returning is 0, which I read is deprecated? I have also made sure to request runtime RECORD_AUDIO permission before attempting to initialise the visualiser.

Marshmallow permissions

I have included the Manifest.permission.RECORD_AUDIO and Manifest.permission.MODIFY_AUDIO_SETTINGS but still I'm getting "Cannot initialize Visualizer engine, error: -3" on Marshmallow Devices.

i cant open in android studio

i am getting error
Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Workaround file consumes 1mb (while for many unnecessary)

This is not so much an issue as a request. The workaround file (https://github.com/Cleveroad/WaveInApp/tree/master/library/src/main/res/raw) is even when compressed 1MB in size, thus making up 20% of my final app size. This audio file is a multiple of the size of all code and other resources of this library combined.

Because I use a familiar stream, and because I play it with ExoPlayer, a valid audioSessionId is always present and therefore I do not use the workaround.

It would be amazing if you could either:

  • Switch to a workaround that is based on a algorithm or randomiser, rather than playing a fallback media file.
  • Let users include the fallback file theirselves, and then let them optionally pass the fallback file resource ID to the library when initialising the library. (Example)
  • Provide the fallback file option as an add in:
    'com.cleveroad:audiovisualization-fallbackhack:1.0.0'
  • If the above is not possible, the use of a smaller audio file (shorter and looped for example).

How can i use it with android MediaRecorder?

I am using MediaRecorder to record audio. How can i link this library with my recorder. Here's my recorder:

public void MediaRecorderReady(int recTime) {
    mediaRecorder = new MediaRecorder();
    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    mediaRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
    mediaRecorder.setMaxDuration(recTime);
    mediaRecorder.setOutputFile(AudioSavePathInDevice);
}

Crash when implementing library via XML

I just simply copy paste what you had been posted on github:The xml code to include the library int my project,but your greatest library giving such exception

    Caused by: java.lang.reflect.InvocationTargetException
                                                               at java.lang.reflect.Constructor.newInstance(Native Method)
                                                               at android.view.LayoutInflater.createView(LayoutInflater.java:619)
                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                                               at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                                                               at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                               at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                               at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                               at com.equalizer.MainActivity.onCreate(MainActivity.java:14) 
                                                               at android.app.Activity.performCreate(Activity.java:6237) 
                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                               at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                               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) 
                                                            Caused by: android.content.res.Resources$NotFoundException: Array resource ID #0x0
                                                               at android.content.res.Resources.obtainTypedArray(Resources.java:586)
                                                               at com.cleveroad.audiovisualization.GLAudioVisualizationView$Configuration.<init>(GLAudioVisualizationView.java:153)
                                                               at com.cleveroad.audiovisualization.GLAudioVisualizationView.<init>(GLAudioVisualizationView.java:36)
                                                               at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                               at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
                                                               at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                                               at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                                                               at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                               at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                               at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                               at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                               at com.equalizer.MainActivity.onCreate(MainActivity.java:14) 
                                                               at android.app.Activity.performCreate(Activity.java:6237) 
                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                               at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                               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) 

Thank you for great work...This crash i think you have to know what does it means

getting runtime exception first time when app is started

java.lang.RuntimeException: Unable to start activity ComponentInfo{purvil12c.musicplayer/purvil12c.musicplayer.MainActivity}: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3

I've included all permissions in menifest

Visualizer Defect

The Visualizer doesn't seem to work on nexus 5x when there was song played on background, the same problem was seen on samsung devices. Also i saw E/Audio record -38 on logcat.

Nexus 5X

Hi guys, I ve been playing with your lib for a while now, and it works perfectly on my LG G3. But when I run the sample on a Nexus 5X , no wave are moving..Permissions are OK and it seems to go into "ondatareceived".

Any idea ? Maybe problems of compatibility with this device??

Anyway, thanks for the lib !

GLWaveLayer.produceBubbles (Unknown Source) Error

Hi,

Getting error in 4.4.4(Galaxy J1 Ace)

java.util.LinkedList.removeFirstImpl (LinkedList.java:689)
java.util.LinkedList.removeFirst (LinkedList.java:676)
java.util.LinkedList.poll (LinkedList.java:895)

> com.cleveroad.audiovisualization.GLWaveLayer.produceBubbles (Unknown Source)

com.cleveroad.audiovisualization.GLWaveLayer.randomPoints (Unknown Source)
com.cleveroad.audiovisualization.GLRenderer.calmDownListener (Unknown Source)
com.cleveroad.audiovisualization.GLAudioVisualizationView.linkTo (Unknown Source)
com.cleveroad.audiovisualization.DbmHandler.setUp (Unknown Source)
com.cleveroad.audiovisualization.VisualizerDbmHandler.onDataReceivedImpl (Unknown Source)
com.cleveroad.audiovisualization.VisualizerWrapper$1.onFftDataCapture (Unknown Source)
android.media.audiofx.Visualizer$NativeEventHandler.handleCaptureMessage (Visualizer.java:672)
android.media.audiofx.Visualizer$NativeEventHandler.handleMessage (Visualizer.java:700)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:136)
android.app.ActivityThread.main (ActivityThread.java:5590)
java.lang.reflect.Method.invokeNative (Method.java)
java.lang.reflect.Method.invoke (Method.java:515)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1280)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1096)
dalvik.system.NativeStart.main (NativeStart.java)

Thanks.

SpeechRecognizerDbmHandler or VisualizerDbmHandler

Hi, I'm trying to use this library to show visualizer while recording a short audio. (Recording is done with MediaRecorder) So I'm wondering which DbmHandler should I use, or just implement my own DbmHandler?

Cannot Initialize Engine -3

E/AudioEffect: set(): AudioFlinger could not create effect e46b26a0-dddd-11db-8afd-0002a5d5c51b / �h��z, status: -1
E/visualizers-JNI: Visualizer initCheck failed -3
E/Visualizer-JAVA: Error code -3 when initializing Visualizer.
E/AndroidRuntime: FATAL EXCEPTION: Thread-11

java.util.NoSuchElementException from live user

from firebase i got this crash report regarding Cleveroad wave. How can i fix this issue?

Exception java.util.NoSuchElementException:
java.util.LinkedList.removeFirstImpl (LinkedList.java:689)
java.util.LinkedList.removeFirst (LinkedList.java:676)
java.util.LinkedList.poll (LinkedList.java:895)
com.cleveroad.audiovisualization.GLWaveLayer.produceBubbles (GLWaveLayer.java:146)
com.cleveroad.audiovisualization.GLWaveLayer.updateData (GLWaveLayer.java:133)
com.cleveroad.audiovisualization.GLRenderer.onDataReceived (GLRenderer.java:97)
com.cleveroad.audiovisualization.GLAudioVisualizationView.onDataReceived (GLAudioVisualizationView.java:109)
com.cleveroad.audiovisualization.DbmHandler.onDataReceived (DbmHandler.java:44)
com.cleveroad.audiovisualization.VisualizerDbmHandler.onFftDataCapture (VisualizerDbmHandler.java:73)
com.cleveroad.audiovisualization.VisualizerWrapper$1.onFftDataCapture (VisualizerWrapper.java:47)
android.media.audiofx.Visualizer$NativeEventHandler.handleCaptureMessage (Visualizer.java:673)
android.media.audiofx.Visualizer$NativeEventHandler.handleMessage (Visualizer.java:701)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:148)
android.app.ActivityThread.main (ActivityThread.java:7407)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

Color Issue

Hey, alpha values in color is not working. For example if I put the color #805b47b0 it is not reflecting the color with reduced opacity but only #5b47b0 is shown. Kindly help. Thank you in advance!

Transparent background on GLAudioVisualizationView

Is there an easy way to set transparent background on GLAudioVisualizationView (I just want to show the waves without the background) ? I tried to make some modifications in the GLRenderer, but unsuccessfully.
Thanks.

audiovisualization=glview as AudioVisualization ---- not able to get bubbles and waves

Hi, I'm new to kotlin and im trying to set AudioVisualization, Please help me.
1.I have correctly set the code in XML.
2.But in kotlin file. Initially, i declared " var glview: GLAudioVisualizationView? = null ".
while running the code, I'm getting crash in my app as :
=> null cannot be typecast to non-null type in the below code:

override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
audiovisualization=glview as AudioVisualization <------
}

NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

Hi,

When i add your library I'm getting the above mentioned error. Please help.

Mainfest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.dts.aacplayer">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
            android:theme="@style/PlayerTheme"
            android: ="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

app.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.dts.aacplayer"
        minSdkVersion 22
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.exoplayer:exoplayer-core:2.8.3'
    implementation 'com.google.android.exoplayer:exoplayer-dash:2.8.3'
    implementation 'com.google.android.exoplayer:exoplayer-hls:2.8.3'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.8.+'
    implementation 'com.google.android.exoplayer:exoplayer:r2.4.0'
    implementation 'com.cleveroad:audiovisualization:1.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

My activity:

package com.dts.aacplayer;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.media.MediaCodec;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.speech.RecognitionListener;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.cleveroad.audiovisualization.AudioVisualization;
import com.cleveroad.audiovisualization.DbmHandler;
import com.cleveroad.audiovisualization.SpeechRecognizerDbmHandler;
import com.cleveroad.audiovisualization.VisualizerDbmHandler;
import com.google.android.exoplayer2.DefaultLoadControl;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.LoadControl;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.audio.AudioCapabilities;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.extractor.ExtractorsFactory;
import com.google.android.exoplayer2.mediacodec.MediaCodecSelector;
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener;
import com.google.android.exoplayer2.source.ConcatenatingMediaSource;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.LoopingMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.source.dash.DashChunkSource;
import com.google.android.exoplayer2.source.dash.DashMediaSource;
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
import com.google.android.exoplayer2.upstream.Allocator;
import com.google.android.exoplayer2.upstream.BandwidthMeter;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DataSpec;
import com.google.android.exoplayer2.upstream.DefaultAllocator;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.upstream.HttpDataSource;
import com.google.android.exoplayer2.upstream.TransferListener;
import com.google.android.exoplayer2.util.Util;

import static java.security.AccessController.getContext;

public class MainActivity extends AppCompatActivity implements TransferListener<DataSource>, RecognitionListener {


    private SimpleExoPlayer player;
    private static final String TAG = "SSMediaPlayer";
    private PlayerView playerView;
    private AudioVisualization audioVisualization;
   // private String hlsVideoUri = "http://playertest.longtailvideo.com/adaptive/bbbfull/bbbfull.m3u8";
  

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        playerView = findViewById(R.id.video_view);
        audioVisualization = findViewById(R.id.visualizer_view);
        Handler mainHandler = new Handler();
        BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);

        SpeechRecognizerDbmHandler speechRecHandler = DbmHandler.Factory.newSpeechRecognizerHandler(MainActivity.this);
        speechRecHandler.innerRecognitionListener(this);
        audioVisualization.linkTo(speechRecHandler);

        // set audio visualization handler. This will REPLACE previously set speech recognizer handler



        TrackSelection.Factory adaptiveTrackSelection = new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
        TrackSelector trackSelector = new DefaultTrackSelector(adaptiveTrackSelection);
        // 2. Create a default LoadControl
        LoadControl loadControl = new DefaultLoadControl();

        HttpDataSource.Factory factory = new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "Exo2"));


        // 3. Create the player
        //player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);
        player = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(this),
                trackSelector, loadControl);

        playerView.setPlayer(player);

        // Measures bandwidth during playback. Can be null if not required.
        DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter();
        // Produces DataSource instances through which media data is loaded.
        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this,
                Util.getUserAgent(this, "Exo2"), defaultBandwidthMeter);
        // Produces Extractor instances for parsing the media data.
       // ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
        // This is the MediaSource representing the media to be played.

        //HlsMediaSource hlsMediaSource =new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(hlsVideoUri));

     /*   ExtractorMediaSource.Factory extractorsFactory = new ExtractorMediaSource.Factory(
                new DefaultHttpDataSourceFactory("exoplayer-codelab",this,4000,4000,true));
*/
       MediaSource dataSource =  new ExtractorMediaSource.Factory(
               new DefaultHttpDataSourceFactory("exoplayer-codelab",this,4000,4000,true)).createMediaSource(Uri.parse(hlsVideoUri));

        //DefaultUriDataSource defaultUriDataSource = new

        player.addListener(new PlayerEventListener());
        player.prepare(dataSource);
        playerView.requestFocus();
        player.setPlayWhenReady(true);


        VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(MainActivity.this, player.getAudioSessionId());
        audioVisualization.linkTo(vizualizerHandler);


    }

    @Override
    public void onTransferStart(DataSource source, DataSpec dataSpec) {

    }

    @Override
    public void onBytesTransferred(DataSource source, int bytesTransferred) {

    }

    @Override
    public void onTransferEnd(DataSource source) {

    }

    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {

    }

    @Override
    public void onReadyForSpeech(Bundle bundle) {

    }

    @Override
    public void onBeginningOfSpeech() {

    }

    @Override
    public void onRmsChanged(float v) {

    }

    @Override
    public void onBufferReceived(byte[] bytes) {

    }

    @Override
    public void onEndOfSpeech() {

    }

    @Override
    public void onError(int i) {

    }

    @Override
    public void onResults(Bundle bundle) {

    }

    @Override
    public void onPartialResults(Bundle bundle) {

    }

    @Override
    public void onEvent(int i, Bundle bundle) {

    }

    private class PlayerEventListener implements Player.EventListener {

        @Override
        public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason) {


        }

        @Override
        public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {

        }

        @Override
        public void onSeekProcessed() {

        }

        @Override
        public void onPlayerError(ExoPlaybackException error) {
            switch (error.type) {
                case ExoPlaybackException.TYPE_SOURCE:
                    //Crashlytics.logException(new RuntimeException("Exo "+error.getSourceException().getMessage()));
                    Log.e("MediaErr", "TYPE_SOURCE: " + error.getSourceException().getMessage());
                    break;

                case ExoPlaybackException.TYPE_RENDERER:
                    //Crashlytics.logException(new RuntimeException("Exo "+error.getSourceException().getMessage()));
                    Log.e("MediaErr", "TYPE_RENDERER: " + error.getRendererException().getMessage());
                    break;

                case ExoPlaybackException.TYPE_UNEXPECTED:
                    //Crashlytics.logException(new RuntimeException("Exo "+error.getSourceException().getMessage()));
                    Log.e("MediaErr", "TYPE_UNEXPECTED: " + error.getUnexpectedException().getMessage());
                    break;
            }
        }

        @Override
        public void onTimelineChanged(Timeline timeline, @Nullable Object manifest, int reason) {

        }

        @Override
        public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) {

        }

        @Override
        public void onLoadingChanged(boolean isLoading) {

        }

        @Override
        public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {

            String stateString;

            switch (playbackState) {
                case Player.STATE_IDLE: // The player does not have any media to play.
                    stateString = "Player.STATE_IDLE";
                    //mProgressBar.setVisibility(View.VISIBLE);
                    playerView.setKeepScreenOn(false);
                    //mPlayerView.hideController();
                    //mediaControlsLayout.setVisibility(View.GONE);
                    break;
                case Player.STATE_BUFFERING: // The player needs to load media before playing.
                    stateString = "Player.STATE_BUFFERING";
                    //mProgressBar.setVisibility(View.VISIBLE);
                    //mediaControlsLayout.setVisibility(View.GONE);
                    playerView.setKeepScreenOn(true);
                    break;
                case Player.STATE_READY: // The player is able to immediately play from its current position.
                    stateString = "Player.STATE_READY";
                    //mProgressBar.setVisibility(View.INVISIBLE);
                    //mediaControlsLayout.setVisibility(View.VISIBLE);
                    playerView.setKeepScreenOn(true);
                   /* if(isWebSeries) {
                        prepareSkipToNextEpisode();
                        if((player.getContentPosition() < 5000)) {
                            prepareSkipIntro();
                        }

                    }*/

                    break;
                case Player.STATE_ENDED: // The player has finished playing the media.
                    stateString = "Player.STATE_ENDED";
                    playerView.setKeepScreenOn(false);
                    break;
                default:
                    stateString = "UNKNOWN_STATE";
                    break;
            }
            // Log.i(TAG, "onPlayerStateChanged: Changed to State: " + stateString + " - startAutoPlay: " + playWhenReady);
            //updateButtonVisibilities();
        }

        @Override
        public void onRepeatModeChanged(int repeatMode) {

        }

        @Override
        public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {

        }

    }


    @Override
    public void onPause() {
        super.onPause();
        audioVisualization.onPause();
        if (player != null) {
            player.setPlayWhenReady(false); //to pause a video because now our video player is not in focus
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        audioVisualization.release();
        player.release();
    }

    @Override
    public void onResume() {
        super.onResume();
        audioVisualization.onResume();
    }

}

Here are my logs:

java.lang.RuntimeException: com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
	at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:566)
	at com.android.build.gradle.tasks.ProcessApplicationManifest.doFullTaskAction(ProcessApplicationManifest.java:208)
	at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:47)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:284)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:273)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:258)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:145)
	at org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:49)
	at org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34)
	at org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69)
	at org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49)
	at org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:33)
	at org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)
	at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:43)
	at org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:29)
	at org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:134)
	at org.gradle.internal.execution.impl.steps.CacheStep.lambda$execute$3(CacheStep.java:83)
	at java.util.Optional.orElseGet(Optional.java:267)
	at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82)
	at org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:36)
	at org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33)
	at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38)
	at org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
	at java.util.Optional.map(Optional.java:215)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
	at org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:91)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119)
	at org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:94)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
	at com.android.manifmerger.ManifestMerger2.load(ManifestMerger2.java:1016)
	at com.android.manifmerger.ManifestMerger2.merge(ManifestMerger2.java:149)
	at com.android.manifmerger.ManifestMerger2.access$600(ManifestMerger2.java:66)
	at com.android.manifmerger.ManifestMerger2$Invoker.merge(ManifestMerger2.java:1808)
	at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:493)
	... 78 more
Caused by: org.xml.sax.SAXException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
	at com.android.utils.PositionXmlParser$DomBuilder.startElement(PositionXmlParser.java:712)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:176)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:139)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:92)
	at com.android.utils.PositionXmlParser.parse(PositionXmlParser.java:101)
	at com.android.manifmerger.XmlLoader.load(XmlLoader.java:57)
	at com.android.manifmerger.ManifestMerger2.load(ManifestMerger2.java:1006)
	... 82 more
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
	at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.checkNamespaceWF(CoreDocumentImpl.java:2535)
	at com.sun.org.apache.xerces.internal.dom.AttrNSImpl.setName(AttrNSImpl.java:93)
	at com.sun.org.apache.xerces.internal.dom.AttrNSImpl.<init>(AttrNSImpl.java:78)
	at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createAttributeNS(CoreDocumentImpl.java:2164)
	at com.android.utils.PositionXmlParser$DomBuilder.startElement(PositionXmlParser.java:686)
	... 100 more


Layer frequency

Hey. Firstly, thanks for this great and useful library. I have created test app on myself and works like charm!

But when I test only two layer, I saw it's really cool movement. Is there any api to set frequency to layer for seeing more exhilaration?

Thank. Best regards.

Crash on sample app

Hi, when I start SpeechRecognizer or Audio Recording i got a crash direct.

FATAL EXCEPTION: main
  Process: com.cleveroad.audiovisualization.example, PID: 19197
  Theme: themes:{}
  android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.cleveroad.audiovisualization.GLAudioVisualizationView
      at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
      at com.cleveroad.example.SpeechRecognitionFragment.onCreateView(SpeechRecognitionFragment.java:35)
      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
      at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
      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:5456)
      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)
   Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.cleveroad.audiovisualization.GLAudioVisualizationView
      at android.view.LayoutInflater.createView(LayoutInflater.java:645)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
      at com.cleveroad.example.SpeechRecognitionFragment.onCreateView(SpeechRecognitionFragment.java:35) 
      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
      at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) 
      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:5456) 
      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) 
   Caused by: java.lang.reflect.InvocationTargetException
      at java.lang.reflect.Constructor.newInstance(Native Method)
      at android.view.LayoutInflater.createView(LayoutInflater.java:619)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
      at com.cleveroad.example.SpeechRecognitionFragment.onCreateView(SpeechRecognitionFragment.java:35) 
      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
      at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) 
      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:5456) 
      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) 
   Caused by: android.content.res.Resources$NotFoundException: Array resource ID #0x0
      at android.content.res.Resources.obtainTypedArray(Resources.java:608)
      at com.cleveroad.audiovisualization.GLAudioVisualizationView$Configuration.<init>(GLAudioVisualizationView.java:153)
      at com.cleveroad.audiovisualization.GLAudioVisualizationView.<init>(GLAudioVisualizationView.java:36)
      at java.lang.reflect.Constructor.newInstance(Native Method) 
      at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
      at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
      at com.cleveroad.example.SpeechRecognitionFragment.onCreateView(SpeechRecognitionFragment.java:35) 
      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252) 
      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742) 
      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617) 
      at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517) 
      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:5456) 
      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) 

Try to set MediaPlayer - error `Attempt to invoke virtual method`

I am trying to connect the visualiser with a music player from MainActivity.java.
The visualiser is set in a fragment and all works well when I call it showing it in the activity however, overtime I try to add the MusicPlayer i get the error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{example.it/example.it.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.MediaPlayer.getCurrentPosition()' on a null object reference
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                      at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:158)
                      at android.app.ActivityThread.main(ActivityThread.java:7224)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.media.MediaPlayer.getCurrentPosition()' on a null object reference
                      at example.it.AudioVisualizationFragment.onViewCreated(AudioVisualizationFragment.java:60)
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1127)
                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
                      at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
                      at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1677)
                      at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
                      at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:604)
                      at example.it.MainActivity.onStart(MainActivity.java:1210)

I have called the music player from MusicService.java

AudioVisualizationFragment.java

audioVisualization = (AudioVisualization) view;
        audioVisualization.linkTo(DbmHandler.Factory.newVisualizerHandler(getContext(), MusicService.mPlayer));

MainActivity.java

private void openFragment() {
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.audio_player_lyt, AudioVisualizationFragment.newInstance())
                .commit();

    }

How could I solve this error?

Waves Colors

Hello,
thank you for your lib , it's a great work.

I have one questions
when I set the background color transparent the background become black , the question is it possible to set a transparent background.

Best Regard and thank you very much.

Xamarin Android

hi, glad to see a library like this one.

Can you please make this library available for Xamarin.android too?

waves not work when I paly audio

waves not work no matter with MediaPlayer or 3rd Players, it just calme down and nothing happened! even I run your WaveInApp example, still not work. i think you should check and update your code in the project.

ConcurrentModificationException

Hi

First Thanks a lot for your lib, it works pretty well.
Unfortunately, I got some crashs that happens .

  java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
at java.util.HashMap$KeyIterator.next(HashMap.java:833)
 at java.util.AbstractCollection.addAll(AbstractCollection.java:76)
at com.cleveroad.audiovisualization.GLWaveLayer.update(GLWaveLayer.java:92)

It comes from this part :

/**
     * Update waves and bubbles positions.
     * @param dt time elapsed from last calculations
     * @param dAngle delta angle
     * @param ratioY aspect ratio for Y coordinates
     */
    public void update(long dt, float dAngle, float ratioY) {
        float d = dt * dAngle;
        isCalmedDown = true;
        for (GLWave wave : waves) {
            wave.update(d);
            isCalmedDown &= wave.isCalmedDown();
        }
        usedBubbles.addAll(producedBubbles);
        producedBubbles.clear();
        Iterator<GLBubble> iterator = usedBubbles.iterator();
        while (iterator.hasNext()){
            GLBubble bubble = iterator.next();
            bubble.update(dt, ratioY);
            if (bubble.isOffScreen()) {
                unusedBubbles.add(bubble);
                iterator.remove();
            }
        }
    }

My app uses the Android spotify SDKs

Any idea how I could avoid the crash ?

Throws exception if RECORD_AUDIO permission is removed

Why i need to add record audio permission even if i am not recording any thing.

Here is my code:

   @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        audioVisualization = (AudioVisualization) view;
        initMediaPlayer();
        audioVisualization.linkTo(DbmHandler.Factory.newVisualizerHandler(getContext(), mediaPlayer));
        play();
    }

Exception Details:

com.cleveroad.audiovisualization.example E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                          Process: com.cleveroad.audiovisualization.example, PID: 22871
                                                                                          java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -1
                                                                                              at android.media.audiofx.Visualizer.<init>(Visualizer.java:216)
                                                                                              at com.cleveroad.audiovisualization.VisualizerWrapper.<init>(VisualizerWrapper.java:22)
                                                                                              at com.cleveroad.audiovisualization.VisualizerDbmHandler.<init>(VisualizerDbmHandler.java:32)
                                                                                              at com.cleveroad.audiovisualization.VisualizerDbmHandler.<init>(VisualizerDbmHandler.java:36)
                                                                                              at com.cleveroad.audiovisualization.DbmHandler$Factory.newVisualizerHandler(DbmHandler.java:162)
                                                                                              at com.cleveroad.example.AudioVisualizationFragment.onViewCreated(AudioVisualizationFragment.java:48)
                                                                                              at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
                                                                                              at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
                                                                                              at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
                                                                                              at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
                                                                                              at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
                                                                                              at android.os.Handler.handleCallback(Handler.java:739)
                                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                              at android.os.Looper.loop(Looper.java:145)
                                                                                              at android.app.ActivityThread.main(ActivityThread.java:5942)
                                                                                              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:1399)
                                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

Need some help

hey guys i am new into android development and was trying to implement the wave visualization into my app that will play according to some mp3 that I add to the app

i am really lost please help me

Need Help

Can we use this Inside Recyclerview while Playing Audio in Recyclerview TextureView

Crash with speech recognizer and Audio record

Hi,

I tried to run this code on my Galaxy S4 but it crashes with the error below:

05-29 22:33:16.401 26233-26233/com.cleveroad.audiovisualization.example E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cleveroad.audiovisualization.example, PID: 26233
android.view.InflateException: Binary XML file line #8: Error inflating class com.cleveroad.audiovisualization.GLAudioVisualizationView
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at com.cleveroad.example.SpeechRecognitionFragment.onCreateView(SpeechRecognitionFragment.java:35)

How to use this library?

Hello , first of all , this visualizer looks awesome . Would be really nice to use it. But as I am a new developer , I can't figure out how to use it :( . I tried some stuff but didn't really work out. My intention is having this visualizer while playing an audio stream from network.

This is what I tried :

` audioVisualizationView = new GLAudioVisualizationView.Builder(this)
.setBubblesSize(R.dimen.bubble_size)
.setBubblesRandomizeSize(true)
.setWavesHeight(R.dimen.wave_height)
.setWavesFooterHeight(R.dimen.footer_height)
.setWavesCount(7)
.setLayersCount(4)
.setBackgroundColorRes(R.color.av_color_bg)
.setLayerColors(R.array.av_colors)
.setBubblesPerLayer(16)
.build();
layout.addView(audioVisualizationView);

    audioVisualization=(AudioVisualization)audioVisualizationView;
    audioVisualization.linkTo(DbmHandler.Factory.newVisualizerHandler(this, 0));`

And there is a mediaplayer set up for audio playback. How do I link two together?

VisualizerDbmHandler not work in version 1.0.0

i use below method:

// set audio visualization handler. This will REPLACE previously set speech recognizer handler
VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(getContext(), 0);
audioVisualization.linkTo(vizualizerHandler);

i use both :
VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(getContext(), 0);

and

VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(getContext(), mediaplayer);

both method does not work

How can I know whether waves are being shown correctly?

When I run my app on Genymotion emulator, just black screen is shown instead of waves (GLAudioVisualizationView). I would like to hide the GLAudioVisualizationView if that happens. How can I detect whether waves are being displayed correctly or not?

UPDATE:
I just noticed If I rotate the device that black screen is gone and waves are showing up. But, what is the workaround here?

Playing View Can't find

Hey guys, I can't find the page where implement playing view over the wave visualization.
demo
please help me.

Can't handle Audio Focus event after attach MediaPlayer to the VisualizerDbmHandler.

Hi everyone, after attach a MediaPlayer's instance to the VisualizerDbmHandler via the code:

musicHandler = VisualizerDbmHandler.Factory.newVisualizerHandler(this.getApplicationContext(), mediaPlayer);

my AudioFocus Listener doesn't work anymore. Has the VisualizerDbmHandler class subscribe other Listeners?

my project: https://github.com/MinhDang685/MediaPlayerApp/

Visualizer not working when initialize VisualizerDbmHandler with the parameter audioSessionId=0

@Iojjj , I have found your comment in issue 36 https://github.com/Cleveroad/WaveInApp/issues/36 that you said

Pass "0" as audioSessionId to capture mix output of device.

but when I initialize the VisualDbmHandler by the code below and play media with a MediaPlayer instance in the same app, the wave aren't showing. The visualizer only work with audio play from another app (I've try to play a song from my phone music app and It work)
VisualizerDbmHandler vizualizerHandler = DbmHandler.Factory.newVisualizerHandler(getContext(), 0);
How can I fix that?
Thanks

Customizing threshold/inertia on waves?

Really cool lib!

Is there a way to adjust the minimum audio threshold, it seems to me that each way from the top to bottom have a increasing threshold, meaning given the same volume of input, the top wave moves the most and the bottom the least.

Is there a way to customize this threshold?

How can i Animate wave without play or record

I want play wave animate wihout play or record sound, like fake wave visualisazer, how can i do that?
Im using audioVisualization.linkTo(DbmHandler.Factory.newVisualizerHandler(getContext(), 0));
But wave visualisazer just flat and do nothing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.