Tabnine Logo
ErrorFormatter
Code IndexAdd Tabnine to your IDE (free)

How to use
ErrorFormatter
in
com.novoda.noplayer.internal.exoplayer.error

Best Java code snippets using com.novoda.noplayer.internal.exoplayer.error.ErrorFormatter (Showing top 4 results out of 315)

origin: novoda/no-player

  static NoPlayer.PlayerError map(RuntimeException unexpectedException, String message) {
    if (unexpectedException instanceof EGLSurfaceTexture.GlException) {
      return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.EGL_OPERATION_ERROR, message);
    }

    if (unexpectedException instanceof DefaultAudioSink.InvalidAudioTrackTimestampException) {
      return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.SPURIOUS_AUDIO_TRACK_TIMESTAMP_ERROR, message);
    }

    if (unexpectedException instanceof IllegalStateException && message.contains("Multiple renderer media clocks")) {
      return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.MULTIPLE_RENDERER_MEDIA_CLOCK_ENABLED_ERROR, message);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && unexpectedException instanceof MediaCodec.CodecException) {
      String errorMessage = ErrorFormatter.formatCodecException((MediaCodec.CodecException) unexpectedException);
      return new NoPlayerError(PlayerErrorType.UNEXPECTED, DetailErrorType.UNEXPECTED_CODEC_ERROR, errorMessage);
    }

    return new NoPlayerError(PlayerErrorType.UNKNOWN, DetailErrorType.UNKNOWN, message);
  }
}
origin: novoda/no-player

  public static NoPlayer.PlayerError errorFor(ExoPlaybackException exception) {
    String message = ErrorFormatter.formatMessage(exception.getCause());

    switch (exception.type) {
      case ExoPlaybackException.TYPE_SOURCE:
        return SourceErrorMapper.map(exception.getSourceException(), message);
      case ExoPlaybackException.TYPE_RENDERER:
        return RendererErrorMapper.map(exception.getRendererException(), message);
      case ExoPlaybackException.TYPE_UNEXPECTED:
        return UnexpectedErrorMapper.map(exception.getUnexpectedException(), message);
      default:
        return new NoPlayerError(PlayerErrorType.UNKNOWN, DetailErrorType.UNKNOWN, message);
    }
  }
}
origin: novoda/no-player

@Test
public void givenThrowable_whenFormattingMessage_thenReturnsExpectedMessageFormat() {
  String expectedFormat = "com.novoda.noplayer.internal.exoplayer.error.ErrorFormatterTest$IncorrectFormatThrowable: message";
  String actualFormat = ErrorFormatter.formatMessage(new IncorrectFormatThrowable(MESSAGE));
  assertThat(actualFormat).isEqualTo(expectedFormat);
}
origin: novoda/no-player

@Test
public void givenMediaCodecException_whenFormattingMessage_thenReturnsExpectedMessageFormat() {
  MediaCodec.CodecException codecException = mock(MediaCodec.CodecException.class);
  given(codecException.getDiagnosticInfo()).willReturn("android.media.MediaCodec.error_+1234");
  given(codecException.isTransient()).willReturn(true);
  given(codecException.isRecoverable()).willReturn(false);
  String expectedFormat = "diagnosticInformation=android.media.MediaCodec.error_+1234 : isTransient=true : isRecoverable=false";
  String actualFormat = ErrorFormatter.formatCodecException(codecException);
  assertThat(actualFormat).isEqualTo(expectedFormat);
}
com.novoda.noplayer.internal.exoplayer.errorErrorFormatter

Most used methods

  • formatCodecException
  • formatMessage

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onCreateOptionsMenu (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Notification (javax.management)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now