31 lines
787 B
Java
Raw Normal View History

2023-08-25 15:09:19 -04:00
package com.brentvatne.exoplayer;
2023-08-25 15:16:18 -04:00
import android.annotation.SuppressLint;
2023-08-25 15:14:22 -04:00
import com.google.android.exoplayer2.C;
2023-08-25 15:09:19 -04:00
@SuppressLint("InlinedApi")
public enum AudioOutput {
SPEAKER("speaker", C.STREAM_TYPE_MUSIC),
EARPIECE("earpiece", C.STREAM_TYPE_VOICE_CALL);
private final int streamType;
private final String mName;
AudioOutput(final String name, int stream) {
mName = name;
streamType = stream;
}
public static AudioOutput get(String name) {
for (AudioOutput d : values()) {
if (d.mName.equalsIgnoreCase(name))
return d;
}
return SPEAKER;
}
@Override
public String toString() {
return getClass().getSimpleName() + "(" + this.mName + ", " + streamType + ")";
}
}