Java Code Examples for android.media.AudioManager#ACTION_HDMI_AUDIO_PLUG

The following examples show how to use android.media.AudioManager#ACTION_HDMI_AUDIO_PLUG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioCapabilitiesReceiver.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Registers the receiver, meaning it will notify the listener when audio capability changes
 * occur. The current audio capabilities will be returned. It is important to call
 * {@link #unregister} when the receiver is no longer required.
 *
 * @return The current audio capabilities for the device.
 */
@SuppressWarnings("InlinedApi")
public AudioCapabilities register() {
  if (registered) {
    return Assertions.checkNotNull(audioCapabilities);
  }
  registered = true;
  if (externalSurroundSoundSettingObserver != null) {
    externalSurroundSoundSettingObserver.register();
  }
  Intent stickyIntent = null;
  if (receiver != null) {
    IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
    stickyIntent =
        context.registerReceiver(
            receiver, intentFilter, /* broadcastPermission= */ null, handler);
  }
  audioCapabilities = AudioCapabilities.getCapabilities(context, stickyIntent);
  return audioCapabilities;
}
 
Example 2
Source File: AudioCapabilitiesReceiver.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Registers the receiver, meaning it will notify the listener when audio capability changes
 * occur. The current audio capabilities will be returned. It is important to call
 * {@link #unregister} when the receiver is no longer required.
 *
 * @return The current audio capabilities for the device.
 */
@SuppressWarnings("InlinedApi")
public AudioCapabilities register() {
  if (registered) {
    return Assertions.checkNotNull(audioCapabilities);
  }
  registered = true;
  if (externalSurroundSoundSettingObserver != null) {
    externalSurroundSoundSettingObserver.register();
  }
  Intent stickyIntent = null;
  if (receiver != null) {
    IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
    stickyIntent =
        context.registerReceiver(
            receiver, intentFilter, /* broadcastPermission= */ null, handler);
  }
  audioCapabilities = AudioCapabilities.getCapabilities(context, stickyIntent);
  return audioCapabilities;
}
 
Example 3
Source File: AudioCapabilitiesReceiver.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Registers the receiver, meaning it will notify the listener when audio capability changes
 * occur. The current audio capabilities will be returned. It is important to call
 * {@link #unregister} when the receiver is no longer required.
 *
 * @return The current audio capabilities for the device.
 */
@SuppressWarnings("InlinedApi")
public AudioCapabilities register() {
  if (registered) {
    return Assertions.checkNotNull(audioCapabilities);
  }
  registered = true;
  if (externalSurroundSoundSettingObserver != null) {
    externalSurroundSoundSettingObserver.register();
  }
  Intent stickyIntent = null;
  if (receiver != null) {
    IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
    stickyIntent =
        context.registerReceiver(
            receiver, intentFilter, /* broadcastPermission= */ null, handler);
  }
  audioCapabilities = AudioCapabilities.getCapabilities(context, stickyIntent);
  return audioCapabilities;
}
 
Example 4
Source File: MediaPlayer.java    From libvlc-android-sdk with GNU Lesser General Public License v2.1 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void registerAudioPlugV21(boolean register) {
    if (register) {
        final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
        final Intent stickyIntent = mLibVLC.mAppContext.registerReceiver(mAudioPlugReceiver, intentFilter);
        if (stickyIntent != null)
            mAudioPlugReceiver.onReceive(mLibVLC.mAppContext, stickyIntent);
    } else {
        mLibVLC.mAppContext.unregisterReceiver(mAudioPlugReceiver);
    }
}
 
Example 5
Source File: MediaPlayer.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void registerAudioPlugV21(boolean register) {
    if (register) {
        final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
        final Intent stickyIntent = mLibVLC.mAppContext.registerReceiver(mAudioPlugReceiver, intentFilter);
        if (stickyIntent != null)
            mAudioPlugReceiver.onReceive(mLibVLC.mAppContext, stickyIntent);
    } else {
        mLibVLC.mAppContext.unregisterReceiver(mAudioPlugReceiver);
    }
}
 
Example 6
Source File: MediaPlayer.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void registerAudioPlugV21(boolean register) {
    if (register) {
        final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
        final Intent stickyIntent = mLibVLC.mAppContext.registerReceiver(mAudioPlugReceiver, intentFilter);
        if (stickyIntent != null)
            mAudioPlugReceiver.onReceive(mLibVLC.mAppContext, stickyIntent);
    } else {
        mLibVLC.mAppContext.unregisterReceiver(mAudioPlugReceiver);
    }
}
 
Example 7
Source File: MediaPlayer.java    From vlc-example-streamplayer with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void registerAudioPlugV21(boolean register) {
    if (register) {
        final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
        final Intent stickyIntent = mLibVLC.mAppContext.registerReceiver(mAudioPlugReceiver, intentFilter);
        if (stickyIntent != null)
            mAudioPlugReceiver.onReceive(mLibVLC.mAppContext, stickyIntent);
    } else {
        mLibVLC.mAppContext.unregisterReceiver(mAudioPlugReceiver);
    }
}
 
Example 8
Source File: MediaPlayer.java    From libvlc-sdk-android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void registerAudioPlugV21(boolean register) {
    if (register) {
        final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
        final Intent stickyIntent = mLibVLC.mAppContext.registerReceiver(mAudioPlugReceiver, intentFilter);
        if (stickyIntent != null)
            mAudioPlugReceiver.onReceive(mLibVLC.mAppContext, stickyIntent);
    } else {
        mLibVLC.mAppContext.unregisterReceiver(mAudioPlugReceiver);
    }
}
 
Example 9
Source File: PlaybackService.java    From VCL-Android with Apache License 2.0 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void registerV21() {
    final IntentFilter intentFilter = new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG);
    registerReceiver(mReceiverV21, intentFilter);
}