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

Java CastConfiguration类代码示例

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

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



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

示例1: onCreate

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    VideoCastManager castManager = VideoCastManager.getInstance();
    if (!castManager.isFeatureEnabled(CastConfiguration.FEATURE_CAPTIONS_PREFERENCE)) {
        LOGE(TAG, "Did you forget to enable FEATURE_CAPTIONS_PREFERENCE when you initialized"
                + " the VideoCastManage?");
        finish();
        return;
    }
    if (Utils.IS_KITKAT_OR_ABOVE) {
        startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
        finish();
        return;
    }
    addPreferencesFromResource(R.xml.caption_preference);
    castManager.getTracksPreferenceManager().setUpPreferences(getPreferenceScreen());
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:20,代码来源:CaptionsPreferenceActivity.java


示例2: onCreate

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    mContext = this;

    ACRA.init(this);

    CastConfiguration options = new CastConfiguration.Builder(getString(R.string.app_id))
            .enableAutoReconnect()
            .enableLockScreen()
            .enableNotification()
            .setCastControllerImmersive(false)
            .setLaunchOptions(false, Locale.getDefault())
            .setNextPrevVisibilityPolicy(CastConfiguration.NEXT_PREV_VISIBILITY_POLICY_ALWAYS)
            .addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_REWIND, false)
            .addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_FORWARD, false)
            .addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_PLAY_PAUSE, true)
            .addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_DISCONNECT, true)
            .setForwardStep(30)
            .build();
    VideoCastManager.initialize(this, options);
}
 
开发者ID:SferaDev,项目名称:DanaCast,代码行数:23,代码来源:App.java


示例3: initializeCastManager

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
public static VideoCastManager initializeCastManager(Context context) {
    CastConfiguration.Builder builder = new CastConfiguration.Builder(CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID)
            .enableAutoReconnect()
            .enableCaptionManagement()
            .enableWifiReconnection();

    if(BuildConfig.DEBUG){
        builder.enableDebug();
    }

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
    if(preferences.getBoolean("chromecast_lock_screen", true)){
        builder.enableLockScreen();
    }

    if(preferences.getBoolean("chromecast_notification", true)){
        builder.enableNotification()
                .addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_PLAY_PAUSE, true)
                .addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_DISCONNECT, true);
    }

    return VideoCastManager.initialize(context, builder.build());
}
 
开发者ID:ov3rk1ll,项目名称:KinoCast,代码行数:24,代码来源:Utils.java


示例4: updateClosedCaptionState

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
private void updateClosedCaptionState() {
    int state = VideoCastController.CC_HIDDEN;
    if (mCastManager.isFeatureEnabled(CastConfiguration.FEATURE_CAPTIONS_PREFERENCE)
            && mSelectedMedia != null
            /*<archos changes> && mCastManager.getTracksPreferenceManager().isCaptionEnabled()<!archos changes>*/) {
        List<MediaTrack> tracks = mSelectedMedia.getMediaTracks();
        state = Utils.hasAudioOrTextTrack(tracks) ? VideoCastController.CC_ENABLED
                : VideoCastController.CC_DISABLED;
    }
    mCastController.setClosedCaptionState(state);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:VideoCastControllerFragment.java


示例5: initCastFunctionality

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
private void initCastFunctionality() {
	String applicationID = SecretKeys.CHROME_CAST_APPLICATION_ID;
	CastConfiguration options = new CastConfiguration.Builder(applicationID)
										.enableAutoReconnect()
										.enableDebug()
										.enableWifiReconnection()
										.setCastControllerImmersive(false)
										.setTargetActivity(LiveStreamActivity.class)
										.enableNotification()
										.addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_PLAY_PAUSE, true)
										.addNotificationAction(CastConfiguration.NOTIFICATION_ACTION_DISCONNECT,true)
										.enableLockScreen()
										.build();
	VideoCastManager castManager = VideoCastManager.initialize(getApplicationContext(), options);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:16,代码来源:PocketPlaysApplication.java


示例6: updateClosedCaptionState

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
private void updateClosedCaptionState() {
    int state = VideoCastController.CC_HIDDEN;
    if (mCastManager.isFeatureEnabled(CastConfiguration.FEATURE_CAPTIONS_PREFERENCE)
            && mSelectedMedia != null
            && mCastManager.getTracksPreferenceManager().isCaptionEnabled()) {
        List<MediaTrack> tracks = mSelectedMedia.getMediaTracks();
        state = Utils.hasAudioOrTextTrack(tracks) ? VideoCastController.CC_ENABLED
                : VideoCastController.CC_DISABLED;
    }
    mCastController.setClosedCaptionState(state);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:12,代码来源:VideoCastControllerFragment.java


示例7: onWifiConnectivityChanged

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
/**
 * Since framework calls this method twice when a change happens, we are guarding against that
 * by caching the state the first time and avoiding the second call if it is the same status.
 */
public void onWifiConnectivityChanged(boolean connected, final String networkSsid) {
    LOGD(TAG, "WIFI connectivity changed to " + (connected ? "enabled" : "disabled"));
    if (connected && !mWifiConnectivity) {
        mWifiConnectivity = true;
        if (mCastManager.isFeatureEnabled(CastConfiguration.FEATURE_WIFI_RECONNECT)) {
            mCastManager.startCastDiscovery();
            mCastManager.reconnectSessionIfPossible(RECONNECTION_ATTEMPT_PERIOD_S, networkSsid);
        }

    } else {
        mWifiConnectivity = connected;
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:18,代码来源:ReconnectionService.java


示例8: onCreate

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    //minimal setup
    CastConfiguration castConfiguration = new CastConfiguration.Builder(CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID)
            .build();
    VideoCastManager.initialize(CastColorApplication.this, castConfiguration);
}
 
开发者ID:andrei-egeniq,项目名称:android-tibits,代码行数:10,代码来源:CastColorApplication.java


示例9: initializeVideoCastManager

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
private static VideoCastManager initializeVideoCastManager(Context ctx) {
    if (castManager == null) {
        final CastConfiguration configuration = new CastConfiguration.Builder(APPLICATION_ID)
                .addNamespace(ctx.getString(R.string.receiver_data_channel))
                .enableNotification()
                .enableWifiReconnection()
                .enableDebug()
                .build();

        castManager = VideoCastManager.initialize(ctx, configuration);
        castManager.setStopOnDisconnect(true);
    }
    return castManager;
}
 
开发者ID:lukasniemeier,项目名称:gcls,代码行数:15,代码来源:CoreApplication.java


示例10: createCastManager

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
private DataCastManager createCastManager(Context ctx) {
    APPLICATION_ID = getString(R.string.app_id);
    Log.d(TAG, APPLICATION_ID);
    CastConfiguration castConfiguration = new CastConfiguration.Builder(APPLICATION_ID).
          addNamespace(mDiceRollerChannel.getNamespace()).build();
    
    mCastMgr = DataCastManager.initialize(ctx, castConfiguration);
    mCastMgr.incrementUiCounter();

    return mCastMgr;
}
 
开发者ID:bdiegel,项目名称:DiceCast-android,代码行数:12,代码来源:MainActivity.java


示例11: setNextPreviousVisibilityPolicy

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
@Override // from VideoCastController
public void setNextPreviousVisibilityPolicy(@CastConfiguration.PrevNextPolicy int policy) {
    mNextPreviousVisibilityPolicy = policy;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:5,代码来源:CastPlayerActivity.java


示例12: initialize

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
public static  synchronized ArchosVideoCastManager initialize(Context context, CastConfiguration options){
    if(options!=null)
    VideoCastManager.initialize(context,options);
    if(sInstance==null)  sInstance = new ArchosVideoCastManager(context);
    return sInstance;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:7,代码来源:ArchosVideoCastManager.java


示例13: onQueueItemsUpdated

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
@Override
public void onQueueItemsUpdated(int queueLength, int position) {
    boolean prevAvailable = position > 0;
    boolean nextAvailable = position < queueLength - 1;
    switch(mNextPreviousVisibilityPolicy) {
        case CastConfiguration.NEXT_PREV_VISIBILITY_POLICY_HIDDEN:
            if (nextAvailable) {
                mSkipNext.setVisibility(View.VISIBLE);
                mSkipNext.setEnabled(true);
            } else {
                mSkipNext.setVisibility(View.INVISIBLE);
            }
            if (prevAvailable) {
                mSkipPrevious.setVisibility(View.VISIBLE);
                mSkipPrevious.setEnabled(true);
            } else {
                mSkipPrevious.setVisibility(View.INVISIBLE);
            }
            break;
        case CastConfiguration.NEXT_PREV_VISIBILITY_POLICY_ALWAYS:
            mSkipNext.setVisibility(View.VISIBLE);
            mSkipNext.setEnabled(true);
            mSkipPrevious.setVisibility(View.VISIBLE);
            mSkipPrevious.setEnabled(true);
            break;
        case CastConfiguration.NEXT_PREV_VISIBILITY_POLICY_DISABLED:
            if (nextAvailable) {
                mSkipNext.setVisibility(View.VISIBLE);
                mSkipNext.setEnabled(true);
            } else {
                mSkipNext.setVisibility(View.VISIBLE);
                mSkipNext.setEnabled(false);
            }
            if (prevAvailable) {
                mSkipPrevious.setVisibility(View.VISIBLE);
                mSkipPrevious.setEnabled(true);
            } else {
                mSkipPrevious.setVisibility(View.VISIBLE);
                mSkipPrevious.setEnabled(false);
            }
            break;
        default:
            LOGE(TAG, "onQueueItemsUpdated(): Invalid NextPreviousPolicy has been set");
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:46,代码来源:VideoCastControllerActivity.java


示例14: build

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
/**
 * Build the MediaStyle notification. The action that are added to this notification are
 * selected by the client application from a pre-defined set of actions
 *
 * @see CastConfiguration.Builder#addNotificationAction(int, boolean)
 **/
protected void build(MediaInfo info, Bitmap bitmap, boolean isPlaying)
        throws CastException, TransientNetworkDisconnectionException, NoConnectionException {

    // Media metadata
    MediaMetadata metadata = info.getMetadata();
    String castingTo = getResources().getString(R.string.ccl_casting_to_device,
            mCastManager.getDeviceName());

    NotificationCompat.Builder builder
            = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_new_notification_pocket_plays)
            .setContentTitle(metadata.getString(MediaMetadata.KEY_TITLE))
            .setContentText(castingTo)
            .setContentIntent(getContentIntent(info))
            .setLargeIcon(bitmap)
            .setStyle(new NotificationCompat.MediaStyle()
                    .setShowActionsInCompactView(mNotificationCompactActionsArray)
                    .setMediaSession(mCastManager.getMediaSessionCompatToken()))
            .setOngoing(true)
            .setShowWhen(false)
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC);

    for (Integer notificationType : mNotificationActions) {
        switch (notificationType) {
            case CastConfiguration.NOTIFICATION_ACTION_DISCONNECT:
                builder.addAction(getDisconnectAction());
                break;
            case CastConfiguration.NOTIFICATION_ACTION_PLAY_PAUSE:
                builder.addAction(getPlayPauseAction(info, isPlaying));
                break;
            case CastConfiguration.NOTIFICATION_ACTION_SKIP_NEXT:
                builder.addAction(getSkipNextAction());
                break;
            case CastConfiguration.NOTIFICATION_ACTION_SKIP_PREVIOUS:
                builder.addAction(getSkipPreviousAction());
                break;
            case CastConfiguration.NOTIFICATION_ACTION_FORWARD:
                builder.addAction(getForwardAction(mForwardTimeInMillis));
                break;
            case CastConfiguration.NOTIFICATION_ACTION_REWIND:
                builder.addAction(getRewindAction(mForwardTimeInMillis));
                break;
        }
    }

    mNotification = builder.build();

}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:55,代码来源:VideoCastNotificationService.java


示例15: setNextPreviousVisibilityPolicy

import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
/**
 * Sets the policy for the visibility/status of the Skip Next/Prev buttons. The policy declares
 * what should the visibility or status of these buttons be when the position of the current
 * item is at the edges of the queue. For example, if the current item is the last item in the
 * queue, what should be the visibility or status of the "Skip Next" button. Available policies
 * are:
 * <ul>
 *   <li>{@link CastConfiguration#NEXT_PREV_VISIBILITY_POLICY_ALWAYS}: always show the button
 *   <li>{@link CastConfiguration#NEXT_PREV_VISIBILITY_POLICY_DISABLED}: disable the button
 *   <li>{@link CastConfiguration#NEXT_PREV_VISIBILITY_POLICY_HIDDEN}: hide the button
 * </ul>
 * The default behavior is {@link CastConfiguration#NEXT_PREV_VISIBILITY_POLICY_DISABLED}
 */
void setNextPreviousVisibilityPolicy(@CastConfiguration.PrevNextPolicy int policy);
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:15,代码来源:VideoCastController.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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