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


Java PlaybackStateCompat.State方法代码示例

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


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

示例1: updatePlaybackState

import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void updatePlaybackState(
        @PlaybackStateCompat.State int state, long playbackActions, int position, int mediaId) {
    PlaybackStateCompat.Builder builder =
            new PlaybackStateCompat.Builder()
                    .setActions(playbackActions)
                    .setActiveQueueItemId(mediaId)
                    .setState(state, position, 1.0f);
    mSession.setPlaybackState(builder.build());
}
 
开发者ID:googlesamples,项目名称:android-PictureInPicture,代码行数:10,代码来源:MediaSessionPlaybackActivity.java

示例2: assertMediaStateIs

import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void assertMediaStateIs(@PlaybackStateCompat.State int expectedState) {
    PlaybackState state = rule.getActivity().getMediaController().getPlaybackState();
    assertNotNull(state);
    assertThat(
            "MediaSession is not in the correct state",
            state.getState(),
            is(equalTo(expectedState)));
}
 
开发者ID:googlesamples,项目名称:android-PictureInPicture,代码行数:9,代码来源:MediaSessionPlaybackActivityTest.java

示例3: setNewState

import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void setNewState(@PlaybackStateCompat.State int newPlayerState) {
    mState = newPlayerState;

    // Whether playback goes to completion, or whether it is stopped, the
    // mCurrentMediaPlayedToCompletion is set to true.
    if (mState == PlaybackStateCompat.STATE_STOPPED) {
        mCurrentMediaPlayedToCompletion = true;
    }

    // Work around for MediaPlayer.getCurrentPosition() when it changes while not playing.
    final long reportPosition;
    if (mSeekWhileNotPlaying >= 0) {
        reportPosition = mSeekWhileNotPlaying;

        if (mState == PlaybackStateCompat.STATE_PLAYING) {
            mSeekWhileNotPlaying = -1;
        }
    } else {
        reportPosition = mMediaPlayer == null ? 0 : mMediaPlayer.getCurrentPosition();
    }

    final PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder();
    stateBuilder.setActions(getAvailableActions());
    stateBuilder.setState(mState,
                          reportPosition,
                          1.0f,
                          SystemClock.elapsedRealtime());
    mPlaybackInfoListener.onPlaybackStateChange(stateBuilder.build());
}
 
开发者ID:nazmulidris,项目名称:mediasession-mediaplayer,代码行数:30,代码来源:MediaPlayerAdapter.java

示例4: updatePlaybackState

import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void updatePlaybackState(
        @PlaybackStateCompat.State int state,
        long position,
        MediaDescriptionCompat description) {
    PlaybackStateCompat.Builder builder =
            new PlaybackStateCompat.Builder()
                    .setActions(AVAILABLE_MEDIA_ACTIONS)
                    .setActiveQueueItemId(Long.parseLong(description.getMediaId()))
                    .setState(state, position, 1.0f);
    mSession.setPlaybackState(builder.build());
}
 
开发者ID:googlesamples,项目名称:leanback-assistant,代码行数:12,代码来源:PlaybackFragment.java

示例5: setNewState

import android.support.v4.media.session.PlaybackStateCompat; //导入方法依赖的package包/类
private void setNewState(@PlaybackStateCompat.State int newPlayerState) {
    mState = newPlayerState;

    // Whether playback goes to completion, or whether it is stopped, the
    // mCurrentMediaPlayedToCompletion is set to true.
    if (mState == PlaybackStateCompat.STATE_STOPPED) {
        mCurrentMediaPlayedToCompletion = true;
    }

    // Work around for MediaPlayer.getCurrentPosition() when it changes while not playing.
    final long reportPosition;
    if (mSeekWhileNotPlaying >= 0) {
        reportPosition = mSeekWhileNotPlaying;

        if (mState == PlaybackStateCompat.STATE_PLAYING) {
            mSeekWhileNotPlaying = -1;
        }
    } else {
        reportPosition = mMediaPlayer == null ? 0 : mMediaPlayer.getCurrentPosition();
    }

    final PlaybackStateCompat.Builder stateBuilder = new PlaybackStateCompat.Builder();
    stateBuilder.setActions(getAvailableActions());
    stateBuilder.setState(mState,
            reportPosition,
            1.0f,
            SystemClock.elapsedRealtime());
    mPlaybackInfoListener.onPlaybackStateChange(stateBuilder.build());
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:30,代码来源:MediaPlayerManager.java


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