Java 类com.google.android.exoplayer2.ExoPlayerLibraryInfo 实例源码

项目:Exoplayer2Radio    文件:Util.java   
/**
 * 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;
}
项目:no-player    文件:ExoPlayerTwoImplTest.java   
@Test
public void whenGettingPlayerInformation_thenReturnsPlayerInformation() {
    PlayerInformation playerInformation = player.getPlayerInformation();

    assertThat(playerInformation.getPlayerType()).isEqualTo(PlayerType.EXO_PLAYER);
    assertThat(playerInformation.getVersion()).isEqualTo(ExoPlayerLibraryInfo.VERSION);
}
项目:K-Sonic    文件:Util.java   
/**
 * 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;
}
项目:videoPickPlayer    文件:Util.java   
/**
 * 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;
}
项目:videoPickPlayer    文件:Util.java   
/**
 * 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;
}
项目:transistor    文件:Util.java   
/**
 * 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;
}
项目:Exoplayer2Radio    文件:TraceUtil.java   
/**
 * 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();
  }
}
项目:no-player    文件:ExoPlayerInformation.java   
@Override
public String getVersion() {
    return ExoPlayerLibraryInfo.VERSION;
}
项目:K-Sonic    文件:TraceUtil.java   
/**
 * 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();
  }
}
项目:videoPickPlayer    文件:TraceUtil.java   
/**
 * 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();
  }
}
项目:transistor    文件:TraceUtil.java   
/**
 * 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();
  }
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * 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.
 */
public static <T> T checkNotNull(T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
public static <T> T checkNotNull(T reference, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException(String.valueOf(errorMessage));
  }
  return reference;
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * 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.
 */
public static String checkNotEmpty(String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
public static String checkNotEmpty(String string, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException(String.valueOf(errorMessage));
  }
  return string;
}
项目:no-player    文件:ExoPlayerInformationTest.java   
@Test
public void whenReadingVersion_thenReturnsExoPlayerLibraryVersion() {

    String version = playerInformation.getVersion();

    assertThat(version).isEqualTo(ExoPlayerLibraryInfo.VERSION);
}
项目:K-Sonic    文件:Assertions.java   
/**
 * 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.
 */
public static <T> T checkNotNull(T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
public static <T> T checkNotNull(T reference, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException(String.valueOf(errorMessage));
  }
  return reference;
}
项目:K-Sonic    文件:Assertions.java   
/**
 * 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.
 */
public static String checkNotEmpty(String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
public static String checkNotEmpty(String string, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException(String.valueOf(errorMessage));
  }
  return string;
}
项目:videoPickPlayer    文件:Assertions.java   
/**
 * 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.
 */
public static <T> T checkNotNull(T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
项目:videoPickPlayer    文件:Assertions.java   
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
public static <T> T checkNotNull(T reference, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException(String.valueOf(errorMessage));
  }
  return reference;
}
项目:videoPickPlayer    文件:Assertions.java   
/**
 * 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.
 */
public static String checkNotEmpty(String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
项目:videoPickPlayer    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
public static String checkNotEmpty(String string, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException(String.valueOf(errorMessage));
  }
  return string;
}
项目:transistor    文件:Assertions.java   
/**
 * 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.
 */
public static <T> T checkNotNull(T reference) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException();
  }
  return reference;
}
项目:transistor    文件:Assertions.java   
/**
 * Throws {@link NullPointerException} if {@code reference} is null.
 *
 * @param <T> The type of the reference.
 * @param reference The reference.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null reference that was validated.
 * @throws NullPointerException If {@code reference} is null.
 */
public static <T> T checkNotNull(T reference, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && reference == null) {
    throw new NullPointerException(String.valueOf(errorMessage));
  }
  return reference;
}
项目:transistor    文件:Assertions.java   
/**
 * 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.
 */
public static String checkNotEmpty(String string) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException();
  }
  return string;
}
项目:transistor    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
 *
 * @param string The string to check.
 * @param errorMessage The exception message to use if the check fails. The message is converted
 *     to a string using {@link String#valueOf(Object)}.
 * @return The non-null, non-empty string that was validated.
 * @throws IllegalArgumentException If {@code string} is null or 0-length.
 */
public static String checkNotEmpty(String string, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
    throw new IllegalArgumentException(String.valueOf(errorMessage));
  }
  return string;
}
项目:Exoplayer2Radio    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 * @param sectionName The name of the code section to appear in the trace. This may be at most 127
 *     Unicode code units long.
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @throws IllegalArgumentException If {@code expression} is false.
 */
public static void checkArgument(boolean expression) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalArgumentException();
  }
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @param errorMessage The exception message if an exception is thrown. The message is converted
 *     to a {@link String} using {@link String#valueOf(Object)}.
 * @throws IllegalArgumentException If {@code expression} is false.
 */
public static void checkArgument(boolean expression, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalArgumentException(String.valueOf(errorMessage));
  }
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link IllegalStateException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @throws IllegalStateException If {@code expression} is false.
 */
public static void checkState(boolean expression) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalStateException();
  }
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link IllegalStateException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @param errorMessage The exception message if an exception is thrown. The message is converted
 *     to a {@link String} using {@link String#valueOf(Object)}.
 * @throws IllegalStateException If {@code expression} is false.
 */
public static void checkState(boolean expression, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalStateException(String.valueOf(errorMessage));
  }
}
项目:Exoplayer2Radio    文件:Assertions.java   
/**
 * Throws {@link IllegalStateException} if the calling thread is not the application's main
 * thread.
 *
 * @throws IllegalStateException If the calling thread is not the application's main thread.
 */
public static void checkMainThread() {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && Looper.myLooper() != Looper.getMainLooper()) {
    throw new IllegalStateException("Not in applications main thread");
  }
}
项目:K-Sonic    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 * @param sectionName The name of the code section to appear in the trace. This may be at most 127
 *     Unicode code units long.
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @throws IllegalArgumentException If {@code expression} is false.
 */
public static void checkArgument(boolean expression) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalArgumentException();
  }
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link IllegalArgumentException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @param errorMessage The exception message if an exception is thrown. The message is converted
 *     to a {@link String} using {@link String#valueOf(Object)}.
 * @throws IllegalArgumentException If {@code expression} is false.
 */
public static void checkArgument(boolean expression, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalArgumentException(String.valueOf(errorMessage));
  }
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link IllegalStateException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @throws IllegalStateException If {@code expression} is false.
 */
public static void checkState(boolean expression) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalStateException();
  }
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link IllegalStateException} if {@code expression} evaluates to false.
 *
 * @param expression The expression to evaluate.
 * @param errorMessage The exception message if an exception is thrown. The message is converted
 *     to a {@link String} using {@link String#valueOf(Object)}.
 * @throws IllegalStateException If {@code expression} is false.
 */
public static void checkState(boolean expression, Object errorMessage) {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && !expression) {
    throw new IllegalStateException(String.valueOf(errorMessage));
  }
}
项目:K-Sonic    文件:Assertions.java   
/**
 * Throws {@link IllegalStateException} if the calling thread is not the application's main
 * thread.
 *
 * @throws IllegalStateException If the calling thread is not the application's main thread.
 */
public static void checkMainThread() {
  if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && Looper.myLooper() != Looper.getMainLooper()) {
    throw new IllegalStateException("Not in applications main thread");
  }
}