com.google.android.exoplayer2.ExoPlayerLibraryInfo Java Examples

The following examples show how to use com.google.android.exoplayer2.ExoPlayerLibraryInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlUtil.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * If there is an OpenGl error, logs the error and if {@link
 * ExoPlayerLibraryInfo#GL_ASSERTIONS_ENABLED} is true throws a {@link RuntimeException}.
 */
public static void checkGlError() {
  int lastError = GLES20.GL_NO_ERROR;
  int error;
  while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
    Log.e(TAG, "glError " + gluErrorString(error));
    lastError = error;
  }
  if (ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED && lastError != GLES20.GL_NO_ERROR) {
    throw new RuntimeException("glError " + gluErrorString(lastError));
  }
}
 
Example #2
Source File: Assertions.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static <T> T checkNotNull(@Nullable T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
 
Example #3
Source File: Assertions.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static String checkNotEmpty(@Nullable String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
 
Example #4
Source File: ExoPlayerTwoImplTest.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Test
public void whenGettingPlayerInformation_thenReturnsPlayerInformation() {
    PlayerInformation playerInformation = player.getPlayerInformation();

    assertThat(playerInformation.getPlayerType()).isEqualTo(PlayerType.EXO_PLAYER);
    assertThat(playerInformation.getVersion()).isEqualTo(ExoPlayerLibraryInfo.VERSION);
}
 
Example #5
Source File: Util.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * Returns a user agent string based on the given application name and the library version.
 *
 * @param context A valid context of the calling application.
 * @param applicationName String that will be prefix'ed to the generated user agent.
 * @return A user agent string generated using the applicationName and the library version.
 */
public static String getUserAgent(Context context, String applicationName) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
      + ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
 
Example #6
Source File: Assertions.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static String checkNotEmpty(@Nullable String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
 
Example #7
Source File: Assertions.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static String checkNotEmpty(@Nullable String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
 
Example #8
Source File: GlUtil.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If there is an OpenGl error, logs the error and if {@link
 * ExoPlayerLibraryInfo#GL_ASSERTIONS_ENABLED} is true throws a {@link RuntimeException}.
 */
public static void checkGlError() {
  int lastError = GLES20.GL_NO_ERROR;
  int error;
  while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
    Log.e(TAG, "glError " + gluErrorString(error));
    lastError = error;
  }
  if (ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED && lastError != GLES20.GL_NO_ERROR) {
    throw new RuntimeException("glError " + gluErrorString(lastError));
  }
}
 
Example #9
Source File: Util.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a user agent string based on the given application name and the library version.
 *
 * @param context A valid context of the calling application.
 * @param applicationName String that will be prefix'ed to the generated user agent.
 * @return A user agent string generated using the applicationName and the library version.
 */
public static String getUserAgent(Context context, String applicationName) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
      + ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
}
 
Example #10
Source File: Assertions.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static <T> T checkNotNull(@Nullable T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
 
Example #11
Source File: Util.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a user agent string based on the given application name and the library version.
 *
 * @param context A valid context of the calling application.
 * @param applicationName String that will be prefix'ed to the generated user agent.
 * @return A user agent string generated using the applicationName and the library version.
 */
public static String getUserAgent(Context context, String applicationName) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
      + ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
}
 
Example #12
Source File: Assertions.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static String checkNotEmpty(@Nullable String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
 
Example #13
Source File: Assertions.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static <T> T checkNotNull(@Nullable T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
 
Example #14
Source File: Assertions.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static <T> T checkNotNull(@Nullable T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
 
Example #15
Source File: Assertions.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Throws {@link IllegalStateException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @return The non-null reference that was validated.
 * @throws IllegalStateException If {@code reference} is null.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static <T> T checkStateNotNull(@Nullable T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new IllegalStateException();
  }
  return reference;
}
 
Example #16
Source File: Assertions.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static String checkNotEmpty(@Nullable String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
 
Example #17
Source File: GlUtil.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If there is an OpenGl error, logs the error and if {@link
 * ExoPlayerLibraryInfo#GL_ASSERTIONS_ENABLED} is true throws a {@link RuntimeException}.
 */
public static void checkGlError() {
  int lastError = GLES20.GL_NO_ERROR;
  int error;
  while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
    Log.e(TAG, "glError " + gluErrorString(error));
    lastError = error;
  }
  if (ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED && lastError != GLES20.GL_NO_ERROR) {
    throw new RuntimeException("glError " + gluErrorString(lastError));
  }
}
 
Example #18
Source File: Util.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a user agent string based on the given application name and the library version.
 *
 * @param context A valid context of the calling application.
 * @param applicationName String that will be prefix'ed to the generated user agent.
 * @return A user agent string generated using the applicationName and the library version.
 */
public static String getUserAgent(Context context, String applicationName) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
      + ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
}
 
Example #19
Source File: Util.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a user agent string based on the given application name and the library version.
 *
 * @param context A valid context of the calling application.
 * @param applicationName String that will be prefix'ed to the generated user agent.
 * @return A user agent string generated using the applicationName and the library version.
 */
public static String getUserAgent(Context context, String applicationName) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
      + ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
}
 
Example #20
Source File: Assertions.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
@SuppressWarnings({"contracts.postcondition.not.satisfied", "return.type.incompatible"})
@EnsuresNonNull({"#1"})
public static <T> T checkNotNull(@Nullable T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
 
Example #21
Source File: Util.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a user agent string based on the given application name and the library version.
 *
 * @param context A valid context of the calling application.
 * @param applicationName String that will be prefix'ed to the generated user agent.
 * @return A user agent string generated using the applicationName and the library version.
 */
public static String getUserAgent(Context context, String applicationName) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return applicationName + "/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE
      + ") " + ExoPlayerLibraryInfo.VERSION_SLASHY;
}
 
Example #22
Source File: TraceUtil.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Writes a trace message to indicate that a given section of code has ended.
 *
 * @see android.os.Trace#endSection()
 */
public static void endSection() {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    endSectionV18();
  }
}
 
Example #23
Source File: GlUtil.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private static void throwGlError(String errorMsg) {
  Log.e(TAG, errorMsg);
  if (ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED) {
    throw new RuntimeException(errorMsg);
  }
}
 
Example #24
Source File: TraceUtil.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
/**
 * Writes a trace message to indicate that a given section of code has ended.
 *
 * @see android.os.Trace#endSection()
 */
public static void endSection() {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    endSectionV18();
  }
}
 
Example #25
Source File: ExoPlayerInformation.java    From no-player with Apache License 2.0 4 votes vote down vote up
@Override
public String getVersion() {
    return ExoPlayerLibraryInfo.VERSION;
}
 
Example #26
Source File: TraceUtil.java    From K-Sonic with MIT License 4 votes vote down vote up
/**
 * Writes a trace message to indicate that a given section of code has ended.
 *
 * @see android.os.Trace#endSection()
 */
public static void endSection() {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    endSectionV18();
  }
}
 
Example #27
Source File: GlUtil.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private static void throwGlError(String errorMsg) {
  Log.e(TAG, errorMsg);
  if (ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED) {
    throw new RuntimeException(errorMsg);
  }
}
 
Example #28
Source File: TraceUtil.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Writes a trace message to indicate that a given section of code has ended.
 *
 * @see android.os.Trace#endSection()
 */
public static void endSection() {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    endSectionV18();
  }
}
 
Example #29
Source File: GlUtil.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private static void throwGlError(String errorMsg) {
  Log.e(TAG, errorMsg);
  if (ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED) {
    throw new RuntimeException(errorMsg);
  }
}
 
Example #30
Source File: TraceUtil.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Writes a trace message to indicate that a given section of code has ended.
 *
 * @see android.os.Trace#endSection()
 */
public static void endSection() {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    endSectionV18();
  }
}