MediaPlayer getAudioSessionId - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for MediaPlayer getAudioSessionId method.

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)}. 
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(); 
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() { 
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);
        } 
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;
5
CodeRank
This code example shows how to use the following methods:getAudioSessionId
        break; 
    } 
  } 
   
  public Visualizer CreateVisualizer() {
    return new Visualizer(player_.getAudioSessionId());
  } 
   
  public State current_state() { 
    return current_state_;
  } 
} 
3
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()  
3
CodeRank
This code example shows how to use the following methods:getAudioSessionId
        player.setAudioSessionId(sessionId);
    } 
 
    @Override 
    public int getAudioSessionId() { 
        return player.getAudioSessionId();
    } 
 
    @Override 
    public void attachAuxEffect(int effectId) {
        player.attachAuxEffect(effectId);
    } 
 
    @Override 
    public void setAuxEffectSendLevel(float level) {
        player.setAuxEffectSendLevel(level);
    } 
 
    @Override 
    public void setOnPreparedListener(OnPreparedListener listener) {
4
CodeRank
This code example shows how to use the following methods:getAudioSessionId
    } 
 
    public EqualizerController(Context context, MediaPlayer mediaPlayer) {
        this.context = context;
        try { 
            equalizer = new Equalizer(0, mediaPlayer.getAudioSessionId());
        } 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);
        } 
    } 
4
CodeRank
This code example shows how to use the following methods:getAudioSessionId, setOnCompletionListener
    { 
      throw new NullPointerException("Cannot link to null MediaPlayer");
    } 
 
    // Create the Visualizer object and attach it to our media player. 
    mVisualizer = new Visualizer(player.getAudioSessionId());
    // [1] is the max capture size (phone dependent) 
    mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
 
    // Pass through Visualizer data to this class 
    Visualizer.OnDataCaptureListener captureListener = new Visualizer.OnDataCaptureListener()
    { 
      @Override 
      public void onWaveFormDataCapture(Visualizer visualizer, byte[] bytes,
          int samplingRate)
      { 
        // will never get called 
      } 
 
      @Override 

5
CodeRank

Related MediaPlayer getAudioSessionId Questions & Answers:

getAudioSessionId Method Overview
Returns the audio session ID.
See Code Examples for other Android MediaPlayer Methods: