• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CastException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException的典型用法代码示例。如果您正苦于以下问题:Java CastException类的具体用法?Java CastException怎么用?Java CastException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CastException类属于com.google.android.libraries.cast.companionlibrary.cast.exceptions包,在下文中一共展示了CastException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: togglePlayback

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
/**
 * Toggles the playback of the movie.
 *
 * @throws CastException
 * @throws NoConnectionException
 * @throws TransientNetworkDisconnectionException
 */
public void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    checkConnectivity();
    boolean isPlaying = isRemoteMediaPlaying();
    if (isPlaying) {
        pause();
    } else {
        if (mState == MediaStatus.PLAYER_STATE_IDLE
                && mIdleReason == MediaStatus.IDLE_REASON_FINISHED) {
            loadMedia(getRemoteMediaInformation(), true, 0);
        } else {
            play();
        }
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:23,代码来源:VideoCastManager.java


示例2: changeVolume

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
private boolean changeVolume(double volumeIncrement, boolean isKeyDown) {
    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
            && getPlaybackStatus() == MediaStatus.PLAYER_STATE_PLAYING
            && isFeatureEnabled(CastConfiguration.FEATURE_LOCKSCREEN)) {
        return false;
    }

    if (isKeyDown) {
        try {
            adjustVolume(volumeIncrement);
        } catch (CastException | TransientNetworkDisconnectionException |
                NoConnectionException e) {
            LOGE(TAG, "Failed to change volume", e);
        }
    }
    return true;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:18,代码来源:VideoCastManager.java


示例3: stop

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void stop(boolean notifyListeners) {
    if (mMediaMetadata != null)
        mMediaMetadata.setTimingSeeked(false);
    try {
        VideoCastManager.getInstance().stop();
    } catch (IllegalStateException | CastException | TransientNetworkDisconnectionException | NoConnectionException e) {
        LOG.e("Error stopping", e);
    }
    if (notifyListeners)
        VideoCastManager.getInstance().removeVideoCastConsumer(mCastConsumer);
    mState = PlaybackStateCompat.STATE_STOPPED;
    if (notifyListeners && mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}
 
开发者ID:lifechurch,项目名称:nuclei-android,代码行数:17,代码来源:CastPlayback.java


示例4: pause

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void pause() {
    try {
        VideoCastManager manager = VideoCastManager.getInstance();
        if (manager.isRemoteMediaLoaded()) {
            manager.pause();
            mCurrentPosition = (int) manager.getCurrentMediaPosition();
        } else {
            loadMedia(mMediaMetadata, false);
        }
    } catch (JSONException | CastException | TransientNetworkDisconnectionException | NoConnectionException | IllegalArgumentException e) {
        if (mCallback != null) {
            mCallback.onError(e, false);
        }
    }
}
 
开发者ID:lifechurch,项目名称:nuclei-android,代码行数:17,代码来源:CastPlayback.java


示例5: pause

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void pause() {
    try {
        if (mCastManager.isRemoteMediaLoaded()) {
            mCastManager.pause();
            mCurrentPosition = (int) mCastManager.getCurrentMediaPosition();
        } else {
            loadMedia(mCurrentMediaId, false);
        }
    } catch (JSONException | CastException | TransientNetworkDisconnectionException
            | NoConnectionException | IllegalArgumentException e) {
        LogHelper.e(TAG, e, "Exception pausing cast playback");
        if (mCallback != null) {
            mCallback.onError(e.getMessage());
        }
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:18,代码来源:CastPlayback.java


示例6: pause

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void pause() {
    try {
        if (mCastManager.isRemoteMediaLoaded()) {
            mCastManager.pause();
            mCurrentPosition = (int) mCastManager.getCurrentMediaPosition();
        } else {
            loadMedia(mCurrentMediaId, false);
        }
    } catch (JSONException | CastException | TransientNetworkDisconnectionException
            | NoConnectionException e) {
        LogHelper.e(TAG, e, "Exception pausing cast playback");
        if (mCallback != null) {
            mCallback.onError(e.getMessage());
        }
    }
}
 
开发者ID:SoumyaParida,项目名称:MyGaana-Universal,代码行数:18,代码来源:CastPlayback.java


示例7: onPlayPauseClicked

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void onPlayPauseClicked(View v) throws CastException, TransientNetworkDisconnectionException, NoConnectionException {
    if(mCastManager.isConnected()&&mOnMiniControllerChangedListener!=null)
        mOnMiniControllerChangedListener.onPlayPauseClicked(v);
    else if(mIsRemoteDisplayConnected){
        if (Player.sPlayer.isPlaying())
            Player.sPlayer.pause();
        else
            Player.sPlayer.start();
        refreshCastListeners();
    }

}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:14,代码来源:ArchosVideoCastManager.java


示例8: pause

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
public void pause() throws CastException, TransientNetworkDisconnectionException, NoConnectionException {
    if(Player.sPlayer!=null) {
        Player.sPlayer.pause();
    }else if (mCastManager.isConnected()){
        mCastManager.pause();
    }
    refreshCastListeners();
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:9,代码来源:ArchosVideoCastManager.java


示例9: play

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
public void play() throws CastException, TransientNetworkDisconnectionException, NoConnectionException {
    if(Player.sPlayer!=null){
        Player.sPlayer.start();
    }
    else if (mCastManager.isConnected()){
        mCastManager.play();
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:9,代码来源:ArchosVideoCastManager.java


示例10: togglePlayback

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
private void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    switch (mPlaybackState) {
        case MediaStatus.PLAYER_STATE_PAUSED:
            mCastManager.play();
            //mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mCastManager.pause();
            //mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            if ((mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE)
                    && (mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_CANCELED)) {
                mCastManager.play();
            } else {
                mCastManager.loadMedia(mSelectedMedia, true, 0);
            }
            //mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        default:
            break;
    }
    mCastController.setPlaybackStatus(mPlaybackState);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:28,代码来源:VideoCastControllerFragment.java


示例11: onPlayPauseClicked

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void onPlayPauseClicked(View v) throws CastException,
        TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    if (mState == MediaStatus.PLAYER_STATE_PLAYING) {
        pause();
    } else {
        boolean isLive = isRemoteStreamLive();
        if ((mState == MediaStatus.PLAYER_STATE_PAUSED && !isLive)
                || (mState == MediaStatus.PLAYER_STATE_IDLE && isLive)) {
            play();
        }
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:15,代码来源:VideoCastManager.java


示例12: setVolume

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
/**
 * Sets the volume. It internally determines if this should be done for <code>stream</code> or
 * <code>device</code> volume.
 *
 * @param volume Should be a value between 0 and 1, inclusive.
 * @throws NoConnectionException
 * @throws TransientNetworkDisconnectionException
 * @throws CastException If setting system volume fails
 *
 * @see {link #setVolumeType()}
 */
public void setVolume(double volume) throws CastException,
        TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    if (volume > 1.0) {
        volume = 1.0;
    } else if (volume < 0) {
        volume = 0.0;
    }
    if (mVolumeType == VolumeType.STREAM) {
        checkRemoteMediaPlayerAvailable();
        mRemoteMediaPlayer.setStreamVolume(mApiClient, volume).setResultCallback(
                new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() {

                    @Override
                    public void onResult(MediaChannelResult result) {
                        if (!result.getStatus().isSuccess()) {
                            onFailed(R.string.ccl_failed_setting_volume,
                                    result.getStatus().getStatusCode());
                        }
                    }
                }
        );
    } else {
        setDeviceVolume(volume);
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:38,代码来源:VideoCastManager.java


示例13: adjustVolume

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
/**
 * Increments (or decrements) the volume by the given amount. It internally determines if this
 * should be done for stream or device volume.
 *
 * @throws NoConnectionException If no connectivity to the device exists
 * @throws TransientNetworkDisconnectionException If framework is still trying to recover from
 * a possibly transient loss of network
 * @throws CastException
 */
public void adjustVolume(double delta) throws CastException,
        TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    double vol = getVolume() + delta;
    if (vol > 1) {
        vol = 1;
    } else if (vol < 0) {
        vol = 0;
    }
    setVolume(vol);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:21,代码来源:VideoCastManager.java


示例14: setMute

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
/**
 * Mutes or un-mutes the volume. It internally determines if this should be done for
 * <code>stream</code> or <code>device</code> volume.
 *
 * @throws CastException
 * @throws NoConnectionException
 * @throws TransientNetworkDisconnectionException
 */
public void setMute(boolean mute) throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    checkConnectivity();
    if (mVolumeType == VolumeType.STREAM) {
        checkRemoteMediaPlayerAvailable();
        mRemoteMediaPlayer.setStreamMute(mApiClient, mute);
    } else {
        setDeviceMute(mute);
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:19,代码来源:VideoCastManager.java


示例15: togglePlayback

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
private void togglePlayback() throws CastException, TransientNetworkDisconnectionException,
        NoConnectionException {
    switch (mPlaybackState) {
        case MediaStatus.PLAYER_STATE_PAUSED:
            mCastManager.play();
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        case MediaStatus.PLAYER_STATE_PLAYING:
            mCastManager.pause();
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            break;
        case MediaStatus.PLAYER_STATE_IDLE:
            if ((mSelectedMedia.getStreamType() == MediaInfo.STREAM_TYPE_LIVE)
                    && (mCastManager.getIdleReason() == MediaStatus.IDLE_REASON_CANCELED)) {
                mCastManager.play();
            } else {
                mCastManager.loadMedia(mSelectedMedia, true, 0);
            }
            mPlaybackState = MediaStatus.PLAYER_STATE_BUFFERING;
            restartTrickplayTimer();
            break;
        default:
            break;
    }
    mCastController.setPlaybackStatus(mPlaybackState);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:28,代码来源:VideoCastControllerFragment.java


示例16: isDeviceOnLocalNetwork

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
/**
 * Returns {@code true} if and only if the selected cast device is on the local network.
 *
 * @throws CastException if no cast device has been selected.
 */
public final boolean isDeviceOnLocalNetwork() throws CastException {
    if (mSelectedCastDevice == null) {
        throw new CastException("No cast device has yet been selected");
    }
    return mSelectedCastDevice.isOnLocalNetwork();
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:12,代码来源:BaseCastManager.java


示例17: adjustDeviceVolume

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
/**
 * Increments (or decrements) the device volume by the given amount.
 *
 * @throws CastException
 * @throws NoConnectionException
 * @throws TransientNetworkDisconnectionException
 */
public final void adjustDeviceVolume(double delta) throws CastException,
        TransientNetworkDisconnectionException, NoConnectionException {
    checkConnectivity();
    double vol = getDeviceVolume();
    if (vol >= 0) {
        setDeviceVolume(vol + delta);
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:16,代码来源:BaseCastManager.java


示例18: setUpNotification

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
private void setUpNotification(final MediaInfo info)
        throws TransientNetworkDisconnectionException, NoConnectionException {
    if (info == null) {
        return;
    }
    if (mBitmapDecoderTask != null) {
        mBitmapDecoderTask.cancel(false);
    }
    Uri imgUri = null;
    try {
        if (!info.getMetadata().hasImages()) {
            build(info, null, mIsPlaying);
            return;
        } else {
            imgUri = info.getMetadata().getImages().get(0).getUrl();
        }
    } catch (CastException e) {
        LOGE(TAG, "Failed to build notification", e);
    }
    mBitmapDecoderTask = new FetchBitmapTask() {
        @Override
        protected void onPostExecute(Bitmap bitmap) {
            try {
                mVideoArtBitmap = Utils.scaleAndCenterCropBitmap(bitmap, mDimensionInPixels,
                        mDimensionInPixels);
                build(info, mVideoArtBitmap, mIsPlaying);
            } catch (CastException | NoConnectionException
                    | TransientNetworkDisconnectionException e) {
                LOGE(TAG, "Failed to set notification for " + info.toString(), e);
            }
            if (mVisible && (mNotification != null)) {
                startForeground(NOTIFICATION_ID, mNotification);
            }
            if (this == mBitmapDecoderTask) {
                mBitmapDecoderTask = null;
            }
        }
    };
    mBitmapDecoderTask.execute(imgUri);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:41,代码来源:VideoCastNotificationService.java


示例19: temporaryStop

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void temporaryStop() {
    if (mMediaMetadata != null)
        mMediaMetadata.setTimingSeeked(false);
    try {
        VideoCastManager.getInstance().pause();
    } catch (IllegalStateException | CastException | TransientNetworkDisconnectionException | NoConnectionException e) {
        LOG.e("Error pausing", e);
    }
    mState = PlaybackStateCompat.STATE_STOPPED;
    if (mCallback != null) {
        mCallback.onPlaybackStatusChanged(mState);
    }
}
 
开发者ID:lifechurch,项目名称:nuclei-android,代码行数:15,代码来源:CastPlayback.java


示例20: onPlayPauseClicked

import com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException; //导入依赖的package包/类
@Override
public void onPlayPauseClicked(View v) throws CastException,
        TransientNetworkDisconnectionException, NoConnectionException {
    LOGD(TAG, "isConnected returning: " + mCastManager.isConnected());
    togglePlayback();
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:7,代码来源:VideoCastControllerFragment.java



注:本文中的com.google.android.libraries.cast.companionlibrary.cast.exceptions.CastException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ThreadControllerWrapper类代码示例发布时间:2022-05-23
下一篇:
Java MimeMessageParser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap