当前位置: 首页>>代码示例>>Java>>正文


Java RemoteControlClient.setPlaybackState方法代码示例

本文整理汇总了Java中android.media.RemoteControlClient.setPlaybackState方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteControlClient.setPlaybackState方法的具体用法?Java RemoteControlClient.setPlaybackState怎么用?Java RemoteControlClient.setPlaybackState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.RemoteControlClient的用法示例。


在下文中一共展示了RemoteControlClient.setPlaybackState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateRemote

import android.media.RemoteControlClient; //导入方法依赖的package包/类
/**
 * Update the remote with new metadata.
 * {@link #registerRemote(Context, AudioManager)} must have been called
 * first.
 *
 * @param context A context to use.
 * @param song The song containing the new metadata.
 * @param state PlaybackService state, used to determine playback state.
 */
public static void updateRemote(Context context, Song song, int state)
{
	RemoteControlClient remote = sRemote;
	if (remote == null)
		return;

	remote.setPlaybackState((state & PlaybackService.FLAG_PLAYING) != 0 ? RemoteControlClient.PLAYSTATE_PLAYING : RemoteControlClient.PLAYSTATE_PAUSED);
	RemoteControlClient.MetadataEditor editor = remote.editMetadata(true);
	if (song != null) {
		editor.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, song.artist);
		editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, song.album);
		editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, song.title);
		Bitmap bitmap = song.getCover(context);
		if (bitmap != null) {
			// Create a copy of the cover art, since RemoteControlClient likes
			// to recycle what we give it.
			bitmap = bitmap.copy(Bitmap.Config.RGB_565, false);
		}
		editor.putBitmap(RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK, bitmap);
	}
	editor.apply();
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:32,代码来源:CompatIcs.java

示例2: a

import android.media.RemoteControlClient; //导入方法依赖的package包/类
public void a(boolean flag, long l1, int i1)
{
    if (m != null)
    {
        RemoteControlClient remotecontrolclient = m;
        byte byte0;
        float f1;
        if (flag)
        {
            byte0 = 3;
        } else
        {
            byte0 = 1;
        }
        if (flag)
        {
            f1 = 1.0F;
        } else
        {
            f1 = 0.0F;
        }
        remotecontrolclient.setPlaybackState(byte0, l1, f1);
        m.setTransportControlFlags(i1);
    }
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:26,代码来源:d.java

示例3: 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

示例4: refreshState

import android.media.RemoteControlClient; //导入方法依赖的package包/类
public void refreshState(boolean flag, long l, int i)
{
    if (mRemoteControl != null)
    {
        RemoteControlClient remotecontrolclient = mRemoteControl;
        float f;
        byte byte0;
        if (flag)
        {
            byte0 = 3;
        } else
        {
            byte0 = 1;
        }
        if (flag)
        {
            f = 1.0F;
        } else
        {
            f = 0.0F;
        }
        remotecontrolclient.setPlaybackState(byte0, l, f);
        mRemoteControl.setTransportControlFlags(i);
    }
}
 
开发者ID:Hamz-a,项目名称:MyCTFWriteUps,代码行数:26,代码来源:TransportMediatorJellybeanMR2.java

示例5: 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

示例6: 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

示例7: 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

示例8: setMetaData

import android.media.RemoteControlClient; //导入方法依赖的package包/类
@TargetApi(19)
private void setMetaData() {

    RemoteControlClient localRemoteControlClient = (RemoteControlClient) this.remoteControlClient;

    RemoteControlClient.MetadataEditor editor = localRemoteControlClient.editMetadata(true);

    editor.putString(MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, authorField.getText().toString());
    editor.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, bookTitle);

    editor.apply();
    //Set cover too?

    localRemoteControlClient.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);

    LOG.debug("Focus: updated meta-data");
}
 
开发者ID:benjamarle,项目名称:typhon,代码行数:18,代码来源:ReadingFragment.java


注:本文中的android.media.RemoteControlClient.setPlaybackState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。