本文整理匯總了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);
}