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


Java PlaybackState.ACTION_PLAY属性代码示例

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


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

示例1: getAvailableActions

private long getAvailableActions(int nextState) {
    long actions = PlaybackState.ACTION_PLAY |
            PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_PLAY_FROM_SEARCH |
            PlaybackState.ACTION_SKIP_TO_NEXT |
            PlaybackState.ACTION_SKIP_TO_PREVIOUS |
            PlaybackState.ACTION_FAST_FORWARD |
            PlaybackState.ACTION_REWIND |
            PlaybackState.ACTION_PAUSE;

    if (nextState == PlaybackState.STATE_PLAYING) {
        actions |= PlaybackState.ACTION_PAUSE;
    }

    return actions;
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:16,代码来源:PlaybackOverlayFragment.java

示例2: getAvailableActions

private long getAvailableActions() {
    long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_PLAY_FROM_SEARCH;
    if (mPlayingQueue == null || mPlayingQueue.isEmpty()) {
        return actions;
    }
    if (mPlayback.isPlaying()) {
        actions |= PlaybackState.ACTION_PAUSE;
    }
    if (mCurrentIndexOnQueue > 0) {
        actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
    }
    if (mCurrentIndexOnQueue < mPlayingQueue.size() - 1) {
        actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
    }
    return actions;
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:17,代码来源:MusicService.java

示例3: getAvailableActions

private long getAvailableActions() {
    long actions = PlaybackState.ACTION_PLAY |
            PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_PLAY_FROM_SEARCH;

    if (mPlaybackState == LeanbackPlaybackState.PLAYING) {
        actions |= PlaybackState.ACTION_PAUSE;
    }

    return actions;
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:11,代码来源:PlaybackOverlayActivity.java

示例4: getAvailableActions

private long getAvailableActions() {
    long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID | PlaybackState.ACTION_PLAY_FROM_SEARCH;
    MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
    if (playingMessageObject != null) {
        if (!MediaController.getInstance().isAudioPaused()) {
            actions |= PlaybackState.ACTION_PAUSE;
        }
        actions |= PlaybackState.ACTION_SKIP_TO_PREVIOUS;
        actions |= PlaybackState.ACTION_SKIP_TO_NEXT;
    }
    return actions;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:12,代码来源:MusicBrowserService.java

示例5: getAvailableActions

private long getAvailableActions(int nextState) {
	long actions = PlaybackState.ACTION_PLAY |
			PlaybackState.ACTION_SKIP_TO_NEXT |
			PlaybackState.ACTION_SKIP_TO_PREVIOUS |
			PlaybackState.ACTION_FAST_FORWARD |
			PlaybackState.ACTION_REWIND |
			PlaybackState.ACTION_PAUSE;

	if (nextState == PlaybackState.STATE_PLAYING) {
		actions |= PlaybackState.ACTION_PAUSE;
	}

	return actions;
}
 
开发者ID:NiciDieNase,项目名称:chaosflix-leanback,代码行数:14,代码来源:OverlayFragment.java

示例6: getAvailableActions

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public long getAvailableActions() {
    long availableActions = PlaybackState.ACTION_PLAY;
    if(mPlayer!=null){
        if(mPlayer.isPlaying())
            availableActions =PlaybackState.ACTION_PAUSE | PlaybackState.ACTION_STOP;

    }
    return availableActions;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:10,代码来源:PlayerService.java

示例7: getAvailableActions

private long getAvailableActions() {
    long actions = PlaybackState.ACTION_PLAY |
            PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_PLAY_FROM_SEARCH |
            PlaybackState.ACTION_SKIP_TO_NEXT |
            PlaybackState.ACTION_SKIP_TO_PREVIOUS |
            PlaybackState.ACTION_FAST_FORWARD |
            PlaybackState.ACTION_REWIND;

    if (mPlaybackState == LeanbackPlaybackState.PLAYING) actions |= PlaybackState.ACTION_PAUSE;
    return actions;
}
 
开发者ID:hitherejoe,项目名称:PictureInPicturePlayground,代码行数:12,代码来源:PlaybackActivity.java

示例8: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    PlaybackState.Builder stateBuilder = new PlaybackState.Builder();
    stateBuilder.setState(playWhenReady ? PlaybackState.STATE_PLAYING : PlaybackState.STATE_PAUSED, player.getCurrentPosition(), 1.0f);

    long actions = PlaybackState.ACTION_PLAY;
    if (playWhenReady)
        actions |= PlaybackState.ACTION_PAUSE;

    stateBuilder.setActions(actions);
    session.setPlaybackState(stateBuilder.build());
}
 
开发者ID:irtimmer,项目名称:itplayer,代码行数:12,代码来源:PlayerActivity.java

示例9: availableActions

private long availableActions() {
    Log.d ( TAG, "availableActions()...") ;
    long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_SKIP_TO_NEXT  | PlaybackState.ACTION_SKIP_TO_PREVIOUS
            | PlaybackState.ACTION_SKIP_TO_NEXT |PlaybackState.ACTION_PLAY_FROM_SEARCH
            | PlaybackState.ACTION_PLAY_FROM_URI ;
    if (isPlaying()) {
        actions |= PlaybackState.ACTION_PAUSE;
    }
    return actions;
}
 
开发者ID:smitzey,项目名称:AndroidAutoTourGuide,代码行数:11,代码来源:AudioPlaybackHelper.java

示例10: getAvailableActions

private long getAvailableActions() {
    long actions = PlaybackState.ACTION_PLAY | PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_PLAY_FROM_SEARCH |
            PlaybackState.ACTION_SKIP_TO_NEXT  | PlaybackState.ACTION_SKIP_TO_PREVIOUS;
    if (isPlaying()) {
        actions |= PlaybackState.ACTION_PAUSE;
    }
    return actions;
}
 
开发者ID:googlecodelabs,项目名称:android-music-player,代码行数:9,代码来源:PlaybackManager.java

示例11: updateMediaSession

private void updateMediaSession(final String what) {
    LogUtils.i(TAG, "updateMediaSession what : " + what);
    int playState = mIsSupposedToBePlaying
            ? PlaybackState.STATE_PLAYING
            : PlaybackState.STATE_PAUSED;

    long playBackStateActions = PlaybackState.ACTION_PLAY |
            PlaybackState.ACTION_PLAY_PAUSE |
            PlaybackState.ACTION_PLAY_FROM_MEDIA_ID |
            PlaybackState.ACTION_PAUSE |
            PlaybackState.ACTION_SKIP_TO_NEXT |
            PlaybackState.ACTION_SKIP_TO_PREVIOUS |
            PlaybackState.ACTION_STOP;

    if (what.equals(MusicServiceConstants.PLAYSTATE_CHANGED) || what.equals(MusicServiceConstants.POSITION_CHANGED)) {
        mSession.setPlaybackState(new PlaybackState.Builder()
                .setActions(playBackStateActions)
                .setActiveQueueItemId(getAudioId())
                .setState(playState, position(), 1.0f).build());
    } else if (what.equals(META_CHANGED) || what.equals(MusicServiceConstants.QUEUE_CHANGED)) {
        LogUtils.i(TAG, "sadsadsadsad thread id : " + Thread.currentThread().getId() + "name : " + Thread.currentThread().getName());
        /*if (albumArt != null) {
            // RemoteControlClient wants to recycle the bitmaps thrown at it, so we need
            // to make sure not to hand out our cache copy
            Bitmap.Config config = albumArt.getConfig();
            if (config == null) {
                config = Bitmap.Config.ARGB_8888;
            }
            albumArt = albumArt.copy(config, false);
        }*/

        /*mSession.setMetadata(new MediaMetadataCompat.Builder()
                .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, getArtistName())
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST, getAlbumArtistName())
                .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, getAlbumName())
                .putString(MediaMetadataCompat.METADATA_KEY_TITLE, getTrackName())
                .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration())
                .putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, getQueuePosition() + 1)
                .putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, getQueue().length)
                .putString(MediaMetadataCompat.METADATA_KEY_GENRE, getGenreName())
                .putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART,
                        mShowAlbumArtOnLockscreen ? albumArt : null)
                .build());*/

        if (what.equals(MusicServiceConstants.QUEUE_CHANGED)) {
            updateMediaSessionQueue();
        }

        mSession.setPlaybackState(new PlaybackState.Builder()
                .setActions(playBackStateActions)
                .setActiveQueueItemId(getAudioId())
                .setState(playState, position(), 1.0f).build());
    }
    LogUtils.i(TAG, "updateMediaSession finished");
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:55,代码来源:MusicService.java


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