【问题标题】:Google Cast - Cannot Resolve mSelectedDeviceGoogle Cast - 无法解决 mSelectedDevice
【发布时间】:2016-03-29 09:44:33
【问题描述】:

我在制作 Google Cast 服务时遇到问题。我似乎找不到 mSelectedDevice 的用途。我使用的两个教程都没有对此提供足够的解释,也没有详细说明 mSelectedDevice 应该是什么。

public class CastMediaRouterCallback extends MediaRouter.Callback{

@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
    mSelectedDevice = CastDevice.getFromBundle(info.getExtras());
    String routeId = info.getId();
    //Startd NanoHTTPD, Find URI of photo/video, and display on Cast device
}

@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
    teardown();
    mSelectedDevice = null;
}

}

(我正在使用的教程:https://developers.google.com/cast/docs/android_sender /// https://www.binpress.com/tutorial/building-an-android-google-cast-sender-app/161

【问题讨论】:

  • 看起来您的示例代码假定它是一个CastDevice 字段。 CastDevice.getFromBundle 返回一个 CastDevice 的实例。
  • 好的,那么我需要将它切换到什么位置?我还没有看到其他代码使用 castdevice 字段。甚至来自 Google 的示例。

标签: java android google-cast


【解决方案1】:

mSelecteDeviceCastDevice 类型的实例变量。不确定您在问题中所说的“Google Cast Service”是什么意思,但似乎您最好从 oue GitHub repo 获取一个示例项目作为您的起点。

【讨论】:

    猜你喜欢
    • 2017-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-08
    • 1970-01-01
    • 1970-01-01
    • 2015-11-16
    • 1970-01-01
    相关资源
    最近更新 更多