本文整理汇总了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());
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例11: setNextPreviousVisibilityPolicy
import com.google.android.libraries.cast.companionlibrary.cast.CastConfiguration; //导入依赖的package包/类
@Override // from VideoCastController
public void setNextPreviousVisibilityPolicy(@CastConfiguration.PrevNextPolicy int policy) {
mNextPreviousVisibilityPolicy = policy;
}
示例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;
}
示例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");
}
}
示例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();
}
示例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);