문제

When trying to stream audio/video on a chromecast device in 50% of cases I get mediaControlChannel:requestDidFailWithID:error: method called about 100 times for the same BEChromeCastMediaItem before it actually starts streaming just fine.

Error Domain=com.google.GCKError Code=4 "The operation couldn’t be completed. (com.google.GCKError error 4.)

(Actually it looks like the whole time I see a "blue progress line" in TV I keep receiving callbacks with this error in the client)

What should we do in such cases? Normally when you get notified about an error, you should handle it (i.e. let user know that something failed) and it's up to you to decide if you want to retry or not, but it looks like chrome cast decides it for you and retries automatically until it succeeds. So what is expected of the iOS client? Should we just ignore these calls?

Update: Error codes seem to change (I also got 1, 93) but they are a always the same for one media item. Anybody knows where to look up error codes? Class chrome.cast.Error does not have any info on this.

도움이 되었습니까?

해결책

There are some descriptions here: https://developers.google.com/cast/docs/reference/ios/g_c_k_error_8h#aea7a716be62f301015e255e1ba63a9cc

Error code 4 you mentioned looks like it means that an invalid request was made.

If you happen to be programming for iOS, in the GCKError.h file, I found there are some additional error codes:

  typedef NS_ENUM(NSInteger, GCKErrorCode) {

  /**
   * Error code indicating a network I/O error.
   */
  GCKErrorCodeNetworkError = 1,

  /**
   * Error code indicating that an operation has timed out.
   */
  GCKErrorCodeTimeout = 2,

  /**
   * Error code indicating an authentication error.
   */
  GCKErrorCodeDeviceAuthenticationFailure = 3,

  /**
   * Error code indicating that an invalid request was made.
   */
  GCKErrorCodeInvalidRequest = 4,

  /**
   * Error code indicating that an in-progress request has been cancelled, most likely because
   * another action has preempted it.
   */
  GCKErrorCodeCancelled = 5,

  /**
   * Error code indicating that the request was disallowed and could not be completed.
   */
  GCKErrorCodeNotAllowed = 6,

  /**
   * Error code indicating that a requested application could not be found.
   */
  GCKErrorCodeApplicationNotFound = 7,

  /**
   * Error code indicating that a requested application is not currently running.
   */
  GCKErrorCodeApplicationNotRunning = 8,

  /**
   * Error code indicating the app entered the background.
   */
  GCKErrorCodeAppDidEnterBackground = 91,

  /**
   * Error code indicating a disconnection occurred during the request.
   */
  GCKErrorCodeDisconnected = 92,

  /**
   * Error code indicating that a request could not be made because the same type of request is
   * still in process.
   */
  GCKErrorCodeDuplicateRequest = 93,

  /**
   * Error code indicating that a media load failed on the receiver side.
   */
  GCKErrorCodeMediaLoadFailed = 94,

  /**
   * Error code indicating that a media media command failed because of the media player state.
   */
  GCKErrorCodeInvalidMediaPlayerState = 95,

  /**
   * Error code indicating that the application session ID was not valid.
   */
  GCKErrorCodeInvalidApplicationSessionID = 96,

  /**
   * Error code indicating that an unknown, unexpected error has occurred.
   */
  GCKErrorCodeUnknown = 99,
};
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top