1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.android.exoplayer2.audio; 17 18 /** A listener for changes in audio configuration. */ 19 public interface AudioListener { 20 21 /** 22 * Called when the audio session is set. 23 * 24 * @param audioSessionId The audio session id. 25 */ onAudioSessionId(int audioSessionId)26 default void onAudioSessionId(int audioSessionId) {} 27 28 /** 29 * Called when the audio attributes change. 30 * 31 * @param audioAttributes The audio attributes. 32 */ onAudioAttributesChanged(AudioAttributes audioAttributes)33 default void onAudioAttributesChanged(AudioAttributes audioAttributes) {} 34 35 /** 36 * Called when the volume changes. 37 * 38 * @param volume The new volume, with 0 being silence and 1 being unity gain. 39 */ onVolumeChanged(float volume)40 default void onVolumeChanged(float volume) {} 41 42 /** 43 * Called when skipping silences is enabled or disabled in the audio stream. 44 * 45 * @param skipSilenceEnabled Whether skipping silences in the audio stream is enabled. 46 */ onSkipSilenceEnabledChanged(boolean skipSilenceEnabled)47 default void onSkipSilenceEnabledChanged(boolean skipSilenceEnabled) {} 48 } 49