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


Java CastContext类代码示例

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


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

示例1: onStart

import com.google.cast.CastContext; //导入依赖的package包/类
@Override
protected void onStart() {
	super.onStart();
	
	checkPlayerName();
       
	awesomePointsView.setText(awesomePoints+"");
	
       CastDevice selectedDevice = CastCAHApplication.getInstance().getDevice();
       CastContext castContext = CastCAHApplication.getInstance().getCastContext();

       mSession = new ApplicationSession(castContext, selectedDevice);
       mSession.setListener(mSessionListener); 
       try {
           mSession.startSession(API_KEY);
       } catch (IOException e) {
           Log.e(TAG, "Failed to open a session", e);
       }
	
       
}
 
开发者ID:leeclarke,项目名称:ChromeCastAgainstHumanity,代码行数:22,代码来源:GameActivity.java

示例2: onStart

import com.google.cast.CastContext; //导入依赖的package包/类
/**
 * Called on application start. Using the previously selected Cast device, attempts to begin a 
 * session using the application name TicTacToe.
 */
@Override
protected void onStart() {
    super.onStart();
    CastDevice selectedDevice = TicTacToeApplication.getInstance().getDevice();
    CastContext castContext =
            TicTacToeApplication.getInstance().getCastContext();

    mSession = new ApplicationSession(castContext, selectedDevice);
    mSession.setListener(mSessionListener);
    try {
        mSession.startSession("TicTacToe");
    } catch (IOException e) {
        Log.e(TAG, "Failed to open a session", e);
    }
}
 
开发者ID:qiushengxy,项目名称:cast-any,代码行数:20,代码来源:GameActivity.java

示例3: initialize

import com.google.cast.CastContext; //导入依赖的package包/类
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
	super.initialize(cordova, webView);
	//Logger.setDebugEnabledByDefault(true);
	receiverCallback = null;
	statusCallback = null;
	castContext = new CastContext(cordova.getActivity().getApplicationContext());
	MediaRouteHelper.registerMinimalMediaRouteProvider(castContext, this);
	mediaRouter = MediaRouter.getInstance(cordova.getActivity().getApplicationContext());
	mediaRouteSelector = MediaRouteHelper.buildMediaRouteSelector(MediaRouteHelper.CATEGORY_CAST, APP_ID, null);
	mediaRouterCallback = new MediaRouterCallback();
	mediaRouter.addCallback(mediaRouteSelector, mediaRouterCallback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
	
       Runnable runnable = new StatusRunner();
       new Thread(runnable).start();		
}
 
开发者ID:rbackhouse,项目名称:chromecast_cordova_plugin,代码行数:16,代码来源:ChromecastPlugin.java

示例4: onCreate

import com.google.cast.CastContext; //导入依赖的package包/类
/**
 * Initializes MediaRouter information and prepares for Cast device detection upon creating
 * this activity.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    logVIfEnabled(TAG, "onCreate called");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cast_sample);

    mCastContext = new CastContext(getApplicationContext());
    mMedia = new CastMedia(null, null);
    mMetaData = new ContentMetadata();

    mDialogFactory = new SampleMediaRouteDialogFactory();

    MediaRouteHelper.registerMinimalMediaRouteProvider(mCastContext, this);
    mMediaRouter = MediaRouter.getInstance(getApplicationContext());
    mMediaRouteSelector = MediaRouteHelper
            .buildMediaRouteSelector(MediaRouteHelper.CATEGORY_CAST);

    mMediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
    mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
    mMediaRouteButton.setDialogFactory(mDialogFactory);
    mMediaRouterCallback = new MyMediaRouterCallback();

    mStatusText = (TextView) findViewById(R.id.play_status_text);
    mCurrentlyPlaying = (TextView) findViewById(R.id.currently_playing);
    mCurrentlyPlaying.setText(getString(R.string.tap_to_select));
    mMediaSelectionDialog = new MediaSelectionDialog(this);

    mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause_button);
    mStopButton = (ImageButton) findViewById(R.id.stop_button);
    initButtons();

    Thread myThread = null;
    Runnable runnable = new StatusRunner();
    myThread = new Thread(runnable);
    logVIfEnabled(TAG, "Starting statusRunner thread");
    myThread.start();
}
 
开发者ID:Cameronjmayfield,项目名称:cast-android-sample,代码行数:42,代码来源:CastSampleActivity.java

示例5: startSession

import com.google.cast.CastContext; //导入依赖的package包/类
public void startSession(CastContext castContext) {

		mKillingSession = false;
		mSession = new ApplicationSession(castContext, getDevice());
		mSession.setListener(new SessionListener());

		try {
			mSession.startSession(castContext.getApplicationContext()
					.getString(R.string.app_id));
		} catch (IOException e) {
			System.err.println(e);
		}

	}
 
开发者ID:dougnlamb,项目名称:FireCast,代码行数:15,代码来源:FireCastSession.java

示例6: onCreate

import com.google.cast.CastContext; //导入依赖的package包/类
@Override
public void onCreate() {
	mCastContext = new CastContext(getApplicationContext());
	mInstance = this;

	showNotification();
}
 
开发者ID:dougnlamb,项目名称:FireCast,代码行数:8,代码来源:FireCastService.java

示例7: initMediaRouter

import com.google.cast.CastContext; //导入依赖的package包/类
private void initMediaRouter() {
	mSessionListener = new SessionListener();
       mMessageStream = new CustomHipstaCasterStream();

       mCastContext = new CastContext(getApplicationContext());
       MediaRouteHelper.registerMinimalMediaRouteProvider(mCastContext, this);
       
       mMediaRouter = MediaRouter.getInstance(getApplicationContext());
       mMediaRouteSelector = MediaRouteHelper.buildMediaRouteSelector(
               MediaRouteHelper.CATEGORY_CAST, APP_NAME, null);
       mMediaRouterCallback = new MediaRouterCallback();
}
 
开发者ID:eriklupander,项目名称:hipstacaster,代码行数:13,代码来源:HipstaActivity.java

示例8: onCreate

import com.google.cast.CastContext; //导入依赖的package包/类
/**
 * Initializes MediaRouter information and prepares for Cast device detection upon creating
 * this activity.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    logVIfEnabled(TAG, "onCreate called");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cast_sample);

    mCastContext = new CastContext(getApplicationContext());
    mMedia = new CastMedia(null, null);
    mMetaData = new ContentMetadata();

    mDialogFactory = new SampleMediaRouteDialogFactory();

    MediaRouteHelper.registerMinimalMediaRouteProvider(mCastContext, this);
    mMediaRouter = MediaRouter.getInstance(getApplicationContext());
    mMediaRouteSelector = MediaRouteHelper
            .buildMediaRouteSelector(MediaRouteHelper.CATEGORY_CAST,
                    getResources().getString(R.string.app_name), null);

    mMediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
    mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
    mMediaRouteButton.setDialogFactory(mDialogFactory);
    mMediaRouterCallback = new MyMediaRouterCallback();

    mStatusText = (TextView) findViewById(R.id.play_status_text);
    mCurrentlyPlaying = (TextView) findViewById(R.id.currently_playing);
    mCurrentlyPlaying.setText(getString(R.string.tap_to_select));
    mMediaSelectionDialog = new MediaSelectionDialog(this);

    mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause_button);
    mStopButton = (ImageButton) findViewById(R.id.stop_button);
    initButtons();

    Thread myThread = null;
    Runnable runnable = new StatusRunner();
    myThread = new Thread(runnable);
    logVIfEnabled(TAG, "Starting statusRunner thread");
    myThread.start();
}
 
开发者ID:johnjohndoe,项目名称:cast-android-sample-android-studio,代码行数:43,代码来源:CastSampleActivity.java

示例9: onCreate

import com.google.cast.CastContext; //导入依赖的package包/类
/**
 * Initializes the CastContext associated with this application's context, upon application
 * creation.
 */
@Override
public final void onCreate() {
    super.onCreate();
    singleton = this;

    try {
        mCastContext = new CastContext(getApplicationContext());
    } catch (IllegalArgumentException e) {
        sLog.e(e, "Unable to create CastContext");
    }
}
 
开发者ID:leeclarke,项目名称:ChromeCastAgainstHumanity,代码行数:16,代码来源:CastCAHApplication.java

示例10: getCastContext

import com.google.cast.CastContext; //导入依赖的package包/类
/**
 * Returns the CastContext associated with this application's context.
 */
public CastContext getCastContext() {
    return mCastContext;
}
 
开发者ID:leeclarke,项目名称:ChromeCastAgainstHumanity,代码行数:7,代码来源:CastCAHApplication.java

示例11: onCreate

import com.google.cast.CastContext; //导入依赖的package包/类
/**
 * Initializes MediaRouter information and prepares for Cast device
 * detection upon creating this activity.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    logVIfEnabled(TAG, "onCreate called");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cast);

    mCastContext = new CastContext(getApplicationContext());
    mMedia = new CastMedia(null, null);
    mMetaData = new ContentMetadata();

    mDialogFactory = new SampleMediaRouteDialogFactory();

    MediaRouteHelper.registerMinimalMediaRouteProvider(mCastContext, this);
    mMediaRouter = MediaRouter.getInstance(getApplicationContext());
    mMediaRouteSelector = MediaRouteHelper
            .buildMediaRouteSelector(MediaRouteHelper.CATEGORY_CAST);

    mMediaRouteButton = (MediaRouteButton) findViewById(R.id.media_route_button);
    mMediaRouteButton.setRouteSelector(mMediaRouteSelector);
    mMediaRouteButton.setDialogFactory(mDialogFactory);
    mMediaRouterCallback = new MyMediaRouterCallback();

    mStatusText = (TextView) findViewById(R.id.play_status_text);
    mCurrentlyPlaying = (TextView) findViewById(R.id.currently_playing);
    mCurrentlyPlaying.setText(getString(R.string.tap_to_select));

    mPlayPauseButton = (ImageButton) findViewById(R.id.play_pause_button);
    mStopButton = (ImageButton) findViewById(R.id.stop_button);
    initButtons();

    myThread = null;
    Runnable runnable = new StatusRunner();
    myThread = new Thread(runnable);
    logVIfEnabled(TAG, "Starting statusRunner thread");
    myThread.start();

    Intent intent = getIntent();
    String url = intent.getStringExtra("MEDIA_URL");
    urls = intent.getStringArrayListExtra("MEDIA_URL_LIST");
    if (urls == null || urls.size() == 0) {
        urls = new ArrayList<String>();
        urls.add(url);
    }
    title = intent.getStringExtra("MEDIA_TITLE");

    if (title == null || title.isEmpty())
        title = urls.get(0);

    this.mediaSelected(new CastMedia(title, urls.get(0)));
    nextUrl++;
}
 
开发者ID:qiushengxy,项目名称:cast-any,代码行数:56,代码来源:CastActivity.java


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