本文整理汇总了Java中android.media.MediaPlayer.getAudioSessionId方法的典型用法代码示例。如果您正苦于以下问题:Java MediaPlayer.getAudioSessionId方法的具体用法?Java MediaPlayer.getAudioSessionId怎么用?Java MediaPlayer.getAudioSessionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.MediaPlayer
的用法示例。
在下文中一共展示了MediaPlayer.getAudioSessionId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VisualizerController
import android.media.MediaPlayer; //导入方法依赖的package包/类
public VisualizerController(MediaPlayer mediaPlayer)
{
try
{
if (mediaPlayer == null)
{
return;
}
audioSessionId = mediaPlayer.getAudioSessionId();
visualizer = new Visualizer(audioSessionId);
}
catch (Throwable x)
{
Log.w(TAG, "Failed to create visualizer.", x);
}
if (visualizer != null)
{
int[] captureSizeRange = Visualizer.getCaptureSizeRange();
int captureSize = Math.max(PREFERRED_CAPTURE_SIZE, captureSizeRange[0]);
captureSize = Math.min(captureSize, captureSizeRange[1]);
visualizer.setCaptureSize(captureSize);
}
}
示例2: EqualizerController
import android.media.MediaPlayer; //导入方法依赖的package包/类
public EqualizerController(Context context, MediaPlayer mediaPlayer)
{
this.context = context;
try
{
if (mediaPlayer == null)
{
return;
}
audioSessionId = mediaPlayer.getAudioSessionId();
equalizer = new Equalizer(0, audioSessionId);
}
catch (Throwable x)
{
equalizer = null;
Log.w(TAG, "Failed to create equalizer.", x);
}
}
示例3: musicHandler
import android.media.MediaPlayer; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
public musicHandler(musicPlayer Gh) {
mEvent = new Event("PLayer");
this.Gh = Gh;
loadStartup();
mediaplayer = new MediaPlayer();
mediaplayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
if(needPlay){
isPrepared = true;
play(needId);
}else{
isPrepared = true;
if(needStop){
needStop = false;
}else{
mediaplayer.start();
}
mediaplayer.setOnCompletionListener(OC);
mEvent.trigger(playerEvents.SONG_CHANGED);
}
}
});
needStop = true;
playByNumber(0);
EQs = new EqlizerSettings(Gh.getBaseContext());
bass = new BassBoost(0, mediaplayer.getAudioSessionId());
bass.setEnabled(true);
equlizer = new Equalizer(0, mediaplayer.getAudioSessionId());
equlizer.setEnabled(true);
virtualizer = new Virtualizer(0, mediaplayer.getAudioSessionId());
virtualizer.setEnabled(true);
if(android.os.Build.VERSION.SDK_INT >= 19){
loudness = new LoudnessEnhancer( mediaplayer.getAudioSessionId());
loudness.setEnabled(true);
}else{
loudness = null;
}
setEQs(EQs.isOn);
setBass(EQs.BASS);
setTrable(EQs.TRABLE);
setVoice(EQs.VOICE);
setVirtualizer(EQs.VIRCHULIZER);
setLoudnessEnhancer(EQs.LOUDNESS);
mEvent.trigger(playerEvents.EQ_CHANGED);
mEvent.trigger(playerEvents.PLAYER_COMPLETE);
}