Example usage for android.media.tv TvInputManager VIDEO_UNAVAILABLE_REASON_UNKNOWN

List of usage examples for android.media.tv TvInputManager VIDEO_UNAVAILABLE_REASON_UNKNOWN

Introduction

In this page you can find the example usage for android.media.tv TvInputManager VIDEO_UNAVAILABLE_REASON_UNKNOWN.

Prototype

int VIDEO_UNAVAILABLE_REASON_UNKNOWN

To view the source code for android.media.tv TvInputManager VIDEO_UNAVAILABLE_REASON_UNKNOWN.

Click Source Link

Document

Reason for TvInputService.Session#notifyVideoUnavailable(int) and TvView.TvInputCallback#onVideoUnavailable(String,int) : Video is unavailable due to an unspecified error.

Usage

From source file:com.android.tv.ui.TunableTvView.java

@UiThread
private void hideScreenByVideoAvailability(int reason) {
    mVideoAvailable = false;/* w w w.j av  a 2s  .  co m*/
    mVideoUnavailableReason = reason;
    if (mInternetCheckTask != null) {
        mInternetCheckTask.cancel(true);
        mInternetCheckTask = null;
    }
    switch (reason) {
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY:
        mHideScreenView.setVisibility(VISIBLE);
        mHideScreenView.setImageVisibility(false);
        mHideScreenView.setText(R.string.tvview_msg_audio_only);
        mBufferingSpinnerView.setVisibility(GONE);
        unmuteIfPossible();
        break;
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING:
        mBufferingSpinnerView.setVisibility(VISIBLE);
        mute();
        break;
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL:
        mHideScreenView.setVisibility(VISIBLE);
        mHideScreenView.setText(R.string.tvview_msg_weak_signal);
        mBufferingSpinnerView.setVisibility(GONE);
        mute();
        break;
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING:
    case VIDEO_UNAVAILABLE_REASON_NOT_TUNED:
        mHideScreenView.setVisibility(VISIBLE);
        mHideScreenView.setImageVisibility(false);
        mHideScreenView.setText(null);
        mBufferingSpinnerView.setVisibility(GONE);
        mute();
        break;
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_UNKNOWN:
    default:
        mHideScreenView.setVisibility(VISIBLE);
        mHideScreenView.setImageVisibility(false);
        mHideScreenView.setText(null);
        mBufferingSpinnerView.setVisibility(GONE);
        mute();
        if (mCurrentChannel != null && !mCurrentChannel.isPhysicalTunerChannel()) {
            mInternetCheckTask = new InternetCheckTask();
            mInternetCheckTask.execute();
        }
        break;
    }
}

From source file:com.android.tv.MainActivity.java

private void updateAvailabilityToast(StreamInfo info) {
    if (info.isVideoAvailable()) {
        return;/*from   w w  w  . jav  a  2 s.  c  o  m*/
    }

    int stringId;
    switch (info.getVideoUnavailableReason()) {
    case TunableTvView.VIDEO_UNAVAILABLE_REASON_NOT_TUNED:
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_TUNING:
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING:
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY:
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL:
        return;
    case TvInputManager.VIDEO_UNAVAILABLE_REASON_UNKNOWN:
    default:
        stringId = R.string.msg_channel_unavailable_unknown;
        break;
    }

    Toast.makeText(this, stringId, Toast.LENGTH_SHORT).show();
}