當前位置: 首頁>>代碼示例>>Java>>正文


Java RemoteControlClient.setTransportControlFlags方法代碼示例

本文整理匯總了Java中android.media.RemoteControlClient.setTransportControlFlags方法的典型用法代碼示例。如果您正苦於以下問題:Java RemoteControlClient.setTransportControlFlags方法的具體用法?Java RemoteControlClient.setTransportControlFlags怎麽用?Java RemoteControlClient.setTransportControlFlags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.media.RemoteControlClient的用法示例。


在下文中一共展示了RemoteControlClient.setTransportControlFlags方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerRemoteControl

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void registerRemoteControl(ComponentName rcvMedia) {
    mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(rcvMedia);
    PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(),
            0, mediaButtonIntent, 0);
    remoteControlClient = new RemoteControlClient(mediaPendingIntent);

    remoteControlClient.setTransportControlFlags(
            RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
                    RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
                    RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
    );
    mAudioManager.registerRemoteControlClient(remoteControlClient);
}
 
開發者ID:dmllr,項目名稱:IdealMedia,代碼行數:17,代碼來源:PlayerService.java

示例2: if

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void registrér() {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) return;
  App.audioManager.registerMediaButtonEventReceiver(fjernbetjeningReciever);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) return;
  // 'det er irriterende at den ændre billedet på lock - screen, det skal være muligt at disable dette.'
  if (!App.prefs.getBoolean("fjernbetjening", true)) return;

  Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON).setComponent(fjernbetjeningReciever);
  PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(ApplicationSingleton.instans, 0, mediaButtonIntent, 0);
  // create and register the remote control client
  remoteControlClient = new RemoteControlClient(mediaPendingIntent);
  remoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
          | RemoteControlClient.FLAG_KEY_MEDIA_NEXT
          | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
          | RemoteControlClient.FLAG_KEY_MEDIA_STOP
          | RemoteControlClient.FLAG_KEY_MEDIA_PLAY
  );
  App.audioManager.registerRemoteControlClient(remoteControlClient);
}
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:21,代碼來源:Fjernbetjening.java

示例3: registerRemoteControlClient

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void registerRemoteControlClient(ComponentName componentName) {

    audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);

    Intent remoteControlIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    remoteControlIntent.setComponent(componentName);

    RemoteControlClient localRemoteControlClient = new RemoteControlClient(
            PendingIntent.getBroadcast(context, 0, remoteControlIntent, 0));

    localRemoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
            | RemoteControlClient.FLAG_KEY_MEDIA_NEXT
            | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
            | RemoteControlClient.FLAG_KEY_MEDIA_PLAY
            | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE
    );

    audioManager.registerRemoteControlClient(localRemoteControlClient);

    this.remoteControlClient = localRemoteControlClient;
}
 
開發者ID:benjamarle,項目名稱:typhon,代碼行數:23,代碼來源:ReadingFragment.java

示例4: registerRemote

import android.media.RemoteControlClient; //導入方法依賴的package包/類
/**
 * Perform initialization required for RemoteControlClient.
 *
 * @param context A context to use.
 * @param am The AudioManager service.
 */
public static void registerRemote(Context context, AudioManager am)
{
	if (!MediaButtonReceiver.useHeadsetControls(context)) {
		// RemoteControlClient requires MEDIA_BUTTON intent
		return;
	}

	MediaButtonReceiver.registerMediaButton(context);

	Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
	mediaButtonIntent.setComponent(new ComponentName(context.getPackageName(), MediaButtonReceiver.class.getName()));
	PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context, 0, mediaButtonIntent, 0);
	RemoteControlClient remote = new RemoteControlClient(mediaPendingIntent);
	int flags = RemoteControlClient.FLAG_KEY_MEDIA_NEXT
		| RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
		| RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
		| RemoteControlClient.FLAG_KEY_MEDIA_PLAY
		| RemoteControlClient.FLAG_KEY_MEDIA_PAUSE;
	remote.setTransportControlFlags(flags);
	am.registerRemoteControlClient(remote);
	sRemote = remote;
}
 
開發者ID:owoc,項目名稱:teardrop,代碼行數:29,代碼來源:CompatIcs.java

示例5: changeRemoteControlClient

import android.media.RemoteControlClient; //導入方法依賴的package包/類
/**
 * Set up the remote control and tell the system we want to be the default receiver for the MEDIA buttons
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void changeRemoteControlClient(AudioManager am, boolean acquire) {
    if (acquire) {
        Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
        mediaButtonIntent.setComponent(mRemoteControlClientReceiverComponent);
        PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, 0);

        // create and register the remote control client
        mRemoteControlClient = new RemoteControlClient(mediaPendingIntent);
        am.registerRemoteControlClient(mRemoteControlClient);

        mRemoteControlClient.setTransportControlFlags(
                RemoteControlClient.FLAG_KEY_MEDIA_PLAY |
                        RemoteControlClient.FLAG_KEY_MEDIA_PAUSE |
                        RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS |
                        RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
                        RemoteControlClient.FLAG_KEY_MEDIA_STOP);
    } else {
        am.unregisterRemoteControlClient(mRemoteControlClient);
        mRemoteControlClient = null;
    }
}
 
開發者ID:jiaZengShen,項目名稱:vlc_android_win,代碼行數:26,代碼來源:PlaybackService.java

示例6: register

import android.media.RemoteControlClient; //導入方法依賴的package包/類
public void register(final Context context, final ComponentName mediaButtonReceiverComponent) {
	downloadService = (DownloadService) context;
	AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

	// build the PendingIntent for the remote control client
	Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
	mediaButtonIntent.setComponent(mediaButtonReceiverComponent);
	PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 0, mediaButtonIntent, 0);

	// create and register the remote control client
	mRemoteControl = new RemoteControlClient(mediaPendingIntent);
	audioManager.registerRemoteControlClient(mRemoteControl);

	mRemoteControl.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
	mRemoteControl.setTransportControlFlags(getTransportFlags());
	imageLoader = SubsonicActivity.getStaticImageLoader(context);
}
 
開發者ID:popeen,項目名稱:Popeens-DSub,代碼行數:18,代碼來源:RemoteControlClientICS.java

示例7: register

import android.media.RemoteControlClient; //導入方法依賴的package包/類
public void register(final Context context, final ComponentName mediaButtonReceiverComponent) {
	downloadService = (DownloadService) context;
	AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

	// build the PendingIntent for the remote control client
	Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
	mediaButtonIntent.setComponent(mediaButtonReceiverComponent);
	PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 0, mediaButtonIntent, 0);

	// create and register the remote control client
	mRemoteControl = new RemoteControlClient(mediaPendingIntent);
	audioManager.registerRemoteControlClient(mRemoteControl);

	mRemoteControl.setPlaybackState(RemoteControlClient.PLAYSTATE_STOPPED);
	mRemoteControl.setTransportControlFlags(getTransportFlags());
	imageLoader = SubsonicTabActivity.getStaticImageLoader(context);
}
 
開發者ID:MadMarty,項目名稱:madsonic-5.5,代碼行數:18,代碼來源:RemoteControlClientICS.java

示例8: setupRemoteControlClient

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private RemoteControlClient setupRemoteControlClient() {
    if (Build.VERSION.SDK_INT < 14) {
        return null;
    }

    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(new ComponentName(getPackageName(),
            MediaButtonReceiver.class.getName()));
    PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(
            getApplicationContext(), 0, mediaButtonIntent, 0);
    remoteControlClient = new RemoteControlClient(mediaPendingIntent);
    int controlFlags;
    if (android.os.Build.VERSION.SDK_INT < 16) {
        controlFlags = RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
                | RemoteControlClient.FLAG_KEY_MEDIA_NEXT;
    } else {
        controlFlags = RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE;
    }
    remoteControlClient.setTransportControlFlags(controlFlags);
    return remoteControlClient;
}
 
開發者ID:danieloeh,項目名稱:AntennaPodSP,代碼行數:23,代碼來源:PlaybackService.java

示例9: registerRCC

import android.media.RemoteControlClient; //導入方法依賴的package包/類
private void registerRCC() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // Create the RCC and register with AudioManager and MediaRouter
        mAudioManager.requestAudioFocus(mAfChangeListener,
                AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
        mAudioManager.registerMediaButtonEventReceiver(mEventReceiver);
        mRemoteControlClient = new RemoteControlClient(mMediaPendingIntent);
        mAudioManager.registerRemoteControlClient(mRemoteControlClient);
        mMediaRouter.addRemoteControlClient(mRemoteControlClient);
        SampleMediaButtonReceiver.setActivity(SampleMediaRouterActivity.this);
        mRemoteControlClient.setTransportControlFlags(
                RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE);
        mRemoteControlClient.setPlaybackState(
                RemoteControlClient.PLAYSTATE_PLAYING);
    }
}
 
開發者ID:benhysell,項目名稱:V.FlyoutTest,代碼行數:17,代碼來源:SampleMediaRouterActivity.java

示例10: registerRemoteControl

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void registerRemoteControl(ComponentName rcvMedia) {
    mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
            AudioManager.AUDIOFOCUS_GAIN);
    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(rcvMedia);
    PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(),
            0, mediaButtonIntent, 0);
    remoteControlClient = new RemoteControlClient(mediaPendingIntent);

    remoteControlClient.setTransportControlFlags(
            RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE |
                    RemoteControlClient.FLAG_KEY_MEDIA_NEXT |
                    RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
    );
    mAudioManager.registerRemoteControlClient(remoteControlClient);
}
 
開發者ID:recoilme,項目名稱:freemp,代碼行數:18,代碼來源:ServicePlayer.java

示例11: registerRemote

import android.media.RemoteControlClient; //導入方法依賴的package包/類
public static void registerRemote(Context context, AudioManager am) {
    MediaButtonReceiver.registerMediaButton(context);

    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(new ComponentName(context.getPackageName(),
            MediaButtonReceiver.class.getName()));
    PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(context, 0,
            mediaButtonIntent, 0);
    RemoteControlClient remote = new RemoteControlClient(mediaPendingIntent);
    int flags = RemoteControlClient.FLAG_KEY_MEDIA_NEXT
            | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS
            | RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
            | RemoteControlClient.FLAG_KEY_MEDIA_PLAY
            | RemoteControlClient.FLAG_KEY_MEDIA_PAUSE;
    remote.setTransportControlFlags(flags);
    am.registerRemoteControlClient(remote);
    sRemote = remote;
}
 
開發者ID:PavelKorolev,項目名稱:liquid-bear-android,代碼行數:19,代碼來源:CompatIcs.java

示例12: RemoteControlClientBroadcaster

import android.media.RemoteControlClient; //導入方法依賴的package包/類
public RemoteControlClientBroadcaster(Context context, CachedFilePropertiesProvider cachedFilePropertiesProvider, ImageProvider imageProvider, RemoteControlClient remoteControlClient) {
	this.context = context;
	this.cachedFilePropertiesProvider = cachedFilePropertiesProvider;
	this.imageProvider = imageProvider;
	this.remoteControlClient = remoteControlClient;
	remoteControlClient.setTransportControlFlags(standardControlFlags);
}
 
開發者ID:danrien,項目名稱:projectBlue,代碼行數:8,代碼來源:RemoteControlClientBroadcaster.java

示例13: setupRemoteControlClient

import android.media.RemoteControlClient; //導入方法依賴的package包/類
private void setupRemoteControlClient() {
  Intent mediaButtonIntent         = new Intent(Intent.ACTION_MEDIA_BUTTON);
  this.mediaButtonEventReceiver    = new ComponentName(getPackageName(), MediaButtonReceiver.class.getName());
  mediaButtonIntent.setComponent(mediaButtonEventReceiver);

  PendingIntent mediaPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
  remoteControlClient              = new RemoteControlClient(mediaPendingIntent);
  remoteControlClient.setTransportControlFlags(RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE);

  audioManager.registerMediaButtonEventReceiver(mediaButtonEventReceiver);
  audioManager.registerRemoteControlClient(remoteControlClient);
}
 
開發者ID:macbury,項目名稱:EnklawaPlayer,代碼行數:13,代碼來源:PlayerService.java

示例14: setup

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@Override
void setup() {
    mAudioManager = (AudioManager) mService.getSystemService(Context.AUDIO_SERVICE);
    mMediaButtonReceiverComponent = new ComponentName(mService.getPackageName(),
            MediaButtonIntentReceiver.class.getName());
    mAudioManager.registerMediaButtonEventReceiver(mMediaButtonReceiverComponent);

    final Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON)
            .setComponent(mMediaButtonReceiverComponent);
    mRemoteControlClient = new RemoteControlClient(
            PendingIntent.getBroadcast(mService.getApplicationContext(), 0, mediaButtonIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT));
    mAudioManager.registerRemoteControlClient(mRemoteControlClient);
    mRemoteControlClient.setTransportControlFlags(getFlags());
}
 
開發者ID:OpenSilk,項目名稱:Orpheus,代碼行數:16,代碼來源:MediaSessionHelper.java

示例15: setUpRemoteControlClient

import android.media.RemoteControlClient; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setUpRemoteControlClient() {
    AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    // Very important to request for the focus.
    audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC,
            AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);

    // Set up the RemoteControlClient to invoke our BroadcastReceiver.
    ComponentName eventReceiver = new ComponentName(this,
            RemoteControlReceiver.class.getName());
    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
    mediaButtonIntent.setComponent(eventReceiver);
    PendingIntent mediaPendingIntent = PendingIntent.
            getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
    mRemoteControlClient = new RemoteControlClient(mediaPendingIntent);

    // Register the remote control client.
    audioManager.registerMediaButtonEventReceiver(eventReceiver);
    audioManager.registerRemoteControlClient(mRemoteControlClient);

    // Add buttons that are needed on the remote control client.
    mRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);

    mRemoteControlClient.setTransportControlFlags(
            RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
            | RemoteControlClient.FLAG_KEY_MEDIA_NEXT
            | RemoteControlClient.FLAG_KEY_MEDIA_PREVIOUS);

    mMediaRouter.addRemoteControlClient(mRemoteControlClient);
}
 
開發者ID:TerribleDev,項目名稱:XamarinAdmobTutorial,代碼行數:31,代碼來源:BaseCastPlayerActivity.java


注:本文中的android.media.RemoteControlClient.setTransportControlFlags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。