-
-
Notifications
You must be signed in to change notification settings - Fork 45
[EN] 6.EqualizerActivity
EqualizerActivity Preview:
dependencies {
implementation 'com.github.jrfeng.snow:ui:1.2'
}
The ui module provides an EqualizerActivity
and an AndroidAudioEffectManager
, which cooperate to implement audio effects. EqualizerActivity
is used to provide users with a UI interface for editing audio effects, and AndroidAudioEffectManager
is used to ensure that audio effects are still valid after exiting EqualizerActivity
and switching songs.
The EqualizerActivity
provides the following 3 kinds of Android audio effects:
Step 1. Register EqualizerActivity
on your AndroidManifest.xml
file:
<activity
android:name="snow.player.ui.equalizer.EqualizerActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/EqualizerTheme" />
Step 2. Override the onCreateAudioEffectManager()
of PlayerService
and return an AndroidAudioEffectManager
instance.
public class MyPlayerService extends PlayerService {
...
@Nullable
@Override
protected AudioEffectManager onCreateAudioEffectManager() {
return new AndroidAudioEffectManager();
}
}
You need use the static method EqualizerActivity.start(Context, Class<? extends PlayerService>)
to start EqualizerActivity
instead of using Context#startActivity()
.
Example:
EqualizerActivity.start(context, MyPlayerService.class);
End