Best code examples for MediaPlayer getAudioSessionId method (android.media.MediaPlayer.getAudioSessionId)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer getAudioSessionId method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

MediaPlayer getAudioSessionId examples from Open Source projects
This code example shows how to use the following methods: getAudioSessionId
	 * Create the equalizer and attach it to the given MediaPlayer's audio 
	 * session. 
	 */ 
	public CompatEq(MediaPlayer player)
	{ 
		Equalizer eq = new Equalizer(0, player.getAudioSessionId());
		eq.setEnabled(true);
		mEq = eq;
	} 
 
	/** 
	 * Call {@link Equalizer#getNumberOfBands()} 
	 */ 
	public short getNumberOfBands() 
	{ 
		return mEq.getNumberOfBands();
	} 
 
	/** 
	 * Call {@link Equalizer#setBandLevel(short, short)}. 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAudioSessionId
                ViewGroup.LayoutParams.FILL_PARENT,
                (int)(VISUALIZER_HEIGHT_DIP * getResources().getDisplayMetrics().density)));
        mLinearLayout.addView(mVisualizerView);
 
        // Create the Visualizer object and attach it to our media player. 
        mVisualizer = new Visualizer(mMediaPlayer.getAudioSessionId());
        mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
        mVisualizer.setDataCaptureListener(new Visualizer.OnDataCaptureListener() {
            public void onWaveFormDataCapture(Visualizer visualizer, byte[] bytes,
                    int samplingRate) {
                mVisualizerView.updateVisualizer(bytes);
            } 
 
            public void onFftDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) {}
        }, Visualizer.getMaxCaptureRate() / 2, true, false);
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getAudioSessionId
    } 
 
    public VisualizerController(Context context, MediaPlayer mediaPlayer) {
        this.context = context;
        try { 
			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);
        } 
    } 
 
    public boolean isAvailable() { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getAudioSessionId
    } 
 
    public EqualizerController(Context context, MediaPlayer mediaPlayer) {
        this.context = context;
        try { 
			audioSessionId = mediaPlayer.getAudioSessionId();
            equalizer = new Equalizer(0, audioSessionId);
        } catch (Throwable x) {
            Log.w(TAG, "Failed to create equalizer.", x);
        } 
    } 
 
    public void saveSettings() { 
        try { 
            if (isAvailable()) { 
                FileUtil.serialize(context, new EqualizerSettings(equalizer), "equalizer.dat");
            } 
        } catch (Throwable x) {
            Log.w(TAG, "Failed to save equalizer settings.", x);
        } 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getAudioSessionId
    } 
 
    public VisualizerController(Context context, MediaPlayer mediaPlayer) {
        this.context = context;
        try { 
            visualizer = new Visualizer(mediaPlayer.getAudioSessionId());
        } 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);
        } 
    } 
 
    public boolean isAvailable() { 
        return visualizer != null;
Full Snippet Info
5
CodeRank
Related MediaPlayer getAudioSessionId Questions & Answers:
getAudioSessionId Method Overview
Returns the audio session ID.
See Code Examples for other Android MediaPlayer Methods: