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


Java PlaybackState.STATE_CONNECTING属性代码示例

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


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

示例1: onClick

@Override
public void onClick(View v) {
    PlaybackState stateObj = getActivity().getMediaController().getPlaybackState();
    final int state = stateObj == null ?
            PlaybackState.STATE_NONE : stateObj.getState();
    LogHelper.d(TAG, "Button pressed, in state " + state);
    switch (v.getId()) {
        case R.id.play_pause:
            LogHelper.d(TAG, "Play button pressed, in state " + state);
            if (state == PlaybackState.STATE_PAUSED ||
                    state == PlaybackState.STATE_STOPPED ||
                    state == PlaybackState.STATE_NONE) {
                playMedia();
            } else if (state == PlaybackState.STATE_PLAYING ||
                    state == PlaybackState.STATE_BUFFERING ||
                    state == PlaybackState.STATE_CONNECTING) {
                pauseMedia();
            }
            break;
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:21,代码来源:PlaybackControlsFragment.java

示例2: isMediaPlaying

@Override
public boolean isMediaPlaying() {
    if (mMediaController.getPlaybackState() == null) {
        return false;
    }
    int state = mMediaController.getPlaybackState().getState();
    return (state == PlaybackState.STATE_BUFFERING
            || state == PlaybackState.STATE_CONNECTING
            || state == PlaybackState.STATE_PLAYING
            || state == PlaybackState.STATE_FAST_FORWARDING
            || state == PlaybackState.STATE_REWINDING
            || state == PlaybackState.STATE_SKIPPING_TO_PREVIOUS
            || state == PlaybackState.STATE_SKIPPING_TO_NEXT);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:14,代码来源:PlaybackControlHelper.java

示例3: prepare

/**
 * Prepares playback.
 *
 * @param doPlay indicates DVR player do or do not start playback after media is prepared.
 */
public void prepare(boolean doPlay) throws IllegalStateException {
    if (DEBUG) Log.d(TAG, "prepare()");
    if (mProgram == null) {
        throw new IllegalStateException("Recorded program not set");
    } else if (mPlaybackState != PlaybackState.STATE_NONE) {
        throw new IllegalStateException("Playback is already prepared");
    }
    mTvView.timeShiftPlay(mProgram.getInputId(), mProgram.getUri());
    mPlaybackState = PlaybackState.STATE_CONNECTING;
    mPauseOnPrepared = !doPlay;
    mCallback.onPlaybackStateChanged(mPlaybackState, 1);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:DvrPlayer.java

示例4: isMediaPlaying

@Override
public boolean isMediaPlaying() {
    PlaybackState playbackState = mMediaController.getPlaybackState();
    if (playbackState == null) {
        return false;
    }
    int state = playbackState.getState();
    return state != PlaybackState.STATE_NONE && state != PlaybackState.STATE_CONNECTING
            && state != PlaybackState.STATE_PAUSED;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:10,代码来源:DvrPlaybackControlHelper.java

示例5: switchToPlayer

/**
 * Helper to switch to a different Playback instance
 * @param playback switch to this playback
 */
private void switchToPlayer(Playback playback, boolean resumePlaying) {
    if (playback == null) {
        throw new IllegalArgumentException("Playback cannot be null");
    }
    // suspend the current one.
    int oldState = mPlayback.getState();
    int pos = mPlayback.getCurrentStreamPosition();
    String currentMediaId = mPlayback.getCurrentMediaId();
    mPlayback.stop(false);
    playback.setCallback(this);
    playback.setCurrentStreamPosition(pos < 0 ? 0 : pos);
    playback.setCurrentMediaId(currentMediaId);
    playback.start();
    // finally swap the instance
    mPlayback = playback;
    switch (oldState) {
        case PlaybackState.STATE_BUFFERING:
        case PlaybackState.STATE_CONNECTING:
        case PlaybackState.STATE_PAUSED:
            mPlayback.pause();
            break;
        case PlaybackState.STATE_PLAYING:
            if (resumePlaying && QueueHelper.isIndexPlayable(mCurrentIndexOnQueue, mPlayingQueue)) {
                mPlayback.play(mPlayingQueue.get(mCurrentIndexOnQueue));
            } else if (!resumePlaying) {
                mPlayback.pause();
            } else {
                mPlayback.stop(true);
            }
            break;
        case PlaybackState.STATE_NONE:
            break;
        default:
            LogHelper.d(TAG, "Default called. Old state is ", oldState);
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:40,代码来源:MusicService.java

示例6: onPlayerStateChanged

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    Timber.e("onPlayerStateChanged: playWhenReady = " + String.valueOf(playWhenReady)
            + " playbackState = " + playbackState);
    switch (playbackState) {
        case PlaybackState.STATE_PLAYING:
            //初始化播放点击事件并设置总时长
            initPlayVideo();
            Timber.e("播放状态: 准备 playing");
            break;

        case PlaybackState.STATE_BUFFERING:
            Timber.e("播放状态: 缓存完成 playing");
            break;

        case PlaybackState.STATE_CONNECTING:
            Timber.e("播放状态: 连接 CONNECTING");
            break;

        case PlaybackState.STATE_ERROR://错误
            Timber.e("播放状态: 错误 STATE_ERROR");
            startPlay.setBackgroundColor(Color.WHITE);
            ToastUtil.showShort("播放错误");
            break;

        case PlaybackState.STATE_FAST_FORWARDING:
            Timber.e("播放状态: 快速传递,播放完毕");

            pausePlay();//暂停播放
            break;

        case PlaybackState.STATE_NONE:
            Timber.e("播放状态: 无 STATE_NONE");
            break;

        case PlaybackState.STATE_PAUSED:
            Timber.e("播放状态: 暂停 PAUSED");
            break;

        case PlaybackState.STATE_REWINDING:
            Timber.e("播放状态: 倒回 REWINDING");
            break;

        case PlaybackState.STATE_SKIPPING_TO_NEXT:
            Timber.e("播放状态: 跳到下一个");
            break;

        case PlaybackState.STATE_SKIPPING_TO_PREVIOUS:
            Timber.e("播放状态: 跳到上一个");
            break;

        case PlaybackState.STATE_SKIPPING_TO_QUEUE_ITEM:
            Timber.e("播放状态: 跳到指定的Item");
            break;

        case PlaybackState.STATE_STOPPED:
            Timber.e("播放状态: 停止的 STATE_STOPPED");
            break;


    }
}
 
开发者ID:ChangWeiBa,项目名称:AesExoPlayer,代码行数:62,代码来源:TestPlayerActivity.java

示例7: isPlaybackPrepared

/**
 * Returns if playback of the recorded program is started.
 */
public boolean isPlaybackPrepared() {
    return mPlaybackState != PlaybackState.STATE_NONE
            && mPlaybackState != PlaybackState.STATE_CONNECTING;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:7,代码来源:DvrPlayer.java

示例8: onStateChanged

private void onStateChanged(int state, long positionMs, int speedLevel) {
    if (DEBUG) Log.d(TAG, "onStateChanged");
    getControlsRow().setCurrentTime((int) positionMs);
    if (state == mPlaybackState && mPlaybackSpeedLevel == speedLevel) {
        // Only position is changed, no need to update controls row
        return;
    }
    // NOTICE: The below two variables should only be used in this method.
    // The only usage of them is to confirm if the state is changed or not.
    mPlaybackState = state;
    mPlaybackSpeedLevel = speedLevel;
    switch (state) {
        case PlaybackState.STATE_PLAYING:
            mPlaybackSpeedId = PLAYBACK_SPEED_NORMAL;
            setFadingEnabled(true);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_PAUSED:
            mPlaybackSpeedId = PLAYBACK_SPEED_PAUSED;
            setFadingEnabled(true);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_FAST_FORWARDING:
            mPlaybackSpeedId = PLAYBACK_SPEED_FAST_L0 + speedLevel;
            setFadingEnabled(false);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_REWINDING:
            mPlaybackSpeedId = -PLAYBACK_SPEED_FAST_L0 - speedLevel;
            setFadingEnabled(false);
            mReadyToControl = true;
            break;
        case PlaybackState.STATE_CONNECTING:
            setFadingEnabled(false);
            mReadyToControl = false;
            break;
        case PlaybackState.STATE_NONE:
            mReadyToControl = false;
            break;
        default:
            setFadingEnabled(true);
            break;
    }
    onStateChanged();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:45,代码来源:DvrPlaybackControlHelper.java


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