Я создаю плагин Google Cast для Unity, и я могу перечислить и выбрать устройство, но при установлении соединения SessionManager возвращает сообщение об ошибке тайм-аута. Из-за этого я даже не могу подключиться к получателю Google по умолчанию
Это мой код подключения. Как я уже сказал, я могу вручную установить соединение, но не могу установить сеанс
CastContext castContext = CastContext.getSharedInstance(context);
castContext.setReceiverApplicationId(CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID);
Intent castIntent = new Intent();
castIntent.putExtra("CAST_INTENT_TO_CAST_ROUTE_ID_KEY", "chromecast-id");
castIntent.putExtra("CAST_INTENT_TO_CAST_DEVICE_NAME_KEY", "chromecast-name");
castIntent.putExtra("CAST_INTENT_TO_CAST_NO_TOAST_KEY", true);
SessionManagerListener sessionListener = new SessionManagerListener<CastSession>() {
@Override
public void onSessionStarting(CastSession session) {
Log.d(TAG, "Session Loading...");
}
@Override
public void onSessionStartFailed(CastSession session, int i) {
Log.e(TAG, "Session failed to start");
Log.e(TAG, "Session disconnected because of error "+ CastStatusCodes.getStatusCodeString(i));
}
};
castContext.getSessionManager().addSessionManagerListener(sessionListener, CastSession.class);
castContext.getSessionManager().startSession(castIntent);
Сеанс всегда завершается неудачно и возвращает идентификатор ошибки 15 (время ожидания) со следующим журналом:
2019-10-29 11:59:28.967 5010-5010/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:28.968 5010-5010/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.043 491-491/? I/SessionManager: startSession: route ID: **ChromeCast ID**, session ID: null
2019-10-29 11:59:29.085 491-491/? D/CAST PLUGIN: Session Loading...
2019-10-29 11:59:29.093 1520-5190/? W/ActivityManager: Permission Denial: Accessing service ComponentInfo{com.google.android.music/com.google.android.music.dial.DialMediaRouteProviderService} from pid=491, uid=10167 that is not exported from uid 10107
2019-10-29 11:59:29.096 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=null, description=null, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.097 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=null, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.097 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.097 491-491/? V/MediaRouter: Adding route: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.097 5010-28273/? I/DiscoveryManager: Filter criteria(%urn:x-cast:com.google.cast.media,CC1AD845) scannerFlags(2)
2019-10-29 11:59:29.124 5010-5010/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.124 5010-5010/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.126 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.126 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.131 5010-28273/? I/DeviceScanner: [MDNS] Received response from "Escritório" (**ChromeCast ID**) with result "2 Updated device"
2019-10-29 11:59:29.137 5010-5010/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.138 5010-5010/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.138 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:29.139 491-491/? V/MediaRouter: Dispatching route change: UserRouteInfo{ name=Escritório, description=Chromecast, status=null, category=RouteCategory{ name=Dispositivos types=ROUTE_TYPE_USER groupable=false }, supportedTypes=ROUTE_TYPE_USER , presentationDisplay=null }
2019-10-29 11:59:31.809 845-845/? I/MSM-irqbalance: Decided to move IRQ104 from CPU6 to CPU7
2019-10-29 11:59:34.088 491-491/? E/CAST PLUGIN: Session failed to start
2019-10-29 11:59:34.089 491-491/? E/CAST PLUGIN: Session disconnected because of error TIMEOUT
Плагин очень простой, и все настройки были скопированы из образца документации: https://codelabs.developers.google.com/codelabs/cast-videos-android/#1