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

项目:miku    文件: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;
}
项目:ExoPlayer-Demo    文件: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;
}
项目:ChannelSurfer    文件:TvInputPlayer.java   
public static String getUserAgent(Context context) {
    String versionName;
    try {
        String packageName = context.getPackageName();
        PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
        versionName = info.versionName;
    } catch (PackageManager.NameNotFoundException e) {
        versionName = "?";
    }
    return "SampleTvInput/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
            ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
项目:android-tv-leanback    文件:MyUtil.java   
public static String getUserAgent(Context context) {
    String versionName;
    try {
        String packageName = context.getPackageName();
        PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
        versionName = info.versionName;
    } catch (NameNotFoundException e) {
        versionName = "?";
    }
    return "ExoPlayerDemo/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
            ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
项目:android-exoplayer    文件:DemoUtil.java   
public static String getUserAgent(Context context) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return "ExoPlayerDemo/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
      ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
项目:Exoplayer_VLC    文件:DemoUtil.java   
public static String getUserAgent(Context context) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return "ExoPlayerDemo/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
      ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
项目:ExoPlayer    文件: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;
}
项目:google-media-framework-android    文件:ExoplayerUtil.java   
/**
 * Generate a User-Agent string that should be sent with HTTP requests. A User-Agent string is
 * used to provide information such as the operating system and version to a server when it makes
 * a request. The server can use this information to select the version of the content which is
 * best suited for your system. For instance, a server could use the User-Agent string provided by
 * this app to ensure that it returns a video format that works on Android.
 * @param context The context (ex {@link android.app.Activity} which is calling this method.
 * @return The User-Agent string.
 */
public static String getUserAgent(Context context) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return "ExoPlayerDemo/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
      ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
项目:player-sdk-native-android    文件:ExoplayerUtil.java   
/**
 * Generate a User-Agent string that should be sent with HTTP requests. A User-Agent string is
 * used to provide information such as the operating system and version to a server when it makes
 * a request. The server can use this information to select the version of the content which is
 * best suited for your system. For instance, a server could use the User-Agent string provided by
 * this app to ensure that it returns a video format that works on Android.
 * @param context The context (ex {@link android.app.Activity} which is calling this method.
 * @return The User-Agent string.
 */
public static String getUserAgent(Context context) {
  String versionName;
  try {
    String packageName = context.getPackageName();
    PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
    versionName = info.versionName;
  } catch (NameNotFoundException e) {
    versionName = "?";
  }
  return "ExoPlayerDemo/" + versionName + " (Linux;Android " + Build.VERSION.RELEASE +
      ") " + "ExoPlayerLib/" + ExoPlayerLibraryInfo.VERSION;
}
项目:miku    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:miku    文件: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();
  }
}
项目:miku    文件:Assertions.java   
/**
 * Ensures that the calling thread is 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");
  }
}
项目:ExoPlayer-Demo    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:ExoPlayer-Demo    文件: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();
  }
}
项目:ExoPlayer-Demo    文件:Assertions.java   
/**
 * Ensures that the calling thread is 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");
  }
}
项目:android-exoplayer    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:android-exoplayer    文件: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();
  }
}
项目:android-exoplayer    文件:Assertions.java   
/**
 * Ensures that the calling thread is 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");
  }
}
项目:Exoplayer_VLC    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:Exoplayer_VLC    文件: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();
  }
}
项目:Exoplayer_VLC    文件:Assertions.java   
/**
 * Ensures that the calling thread is 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");
  }
}
项目:edx-app-android    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:edx-app-android    文件: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();
  }
}
项目:edx-app-android    文件:Assertions.java   
/**
 * Ensures that the calling thread is 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");
  }
}
项目:ExoPlayer    文件:TraceUtil.java   
/**
 * Writes a trace message to indicate that a given section of code has begun.
 *
 * @see android.os.Trace#beginSection(String)
 */
public static void beginSection(String sectionName) {
  if (ExoPlayerLibraryInfo.TRACE_ENABLED && Util.SDK_INT >= 18) {
    beginSectionV18(sectionName);
  }
}
项目:ExoPlayer    文件: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();
  }
}
项目:ExoPlayer    文件:Assertions.java   
/**
 * Ensures that the calling thread is 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");
  }
}
项目:miku    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}
项目:miku    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}
项目:miku    文件:Assertions.java   
/**
 * Ensures that a string passed as an argument to the calling method is not null or 0-length.
 *
 * @param string A string.
 * @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;
}
项目:miku    文件:Assertions.java   
/**
 * Ensures that a string passed as an argument to the calling method is not null or 0-length.
 *
 * @param string A string.
 * @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;
}
项目:ExoPlayer-Demo    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}
项目:ExoPlayer-Demo    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}
项目:ExoPlayer-Demo    文件:Assertions.java   
/**
 * Ensures that a string passed as an argument to the calling method is not null or 0-length.
 *
 * @param string A string.
 * @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;
}
项目:ExoPlayer-Demo    文件:Assertions.java   
/**
 * Ensures that a string passed as an argument to the calling method is not null or 0-length.
 *
 * @param string A string.
 * @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;
}
项目:android-exoplayer    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}
项目:android-exoplayer    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}
项目:android-exoplayer    文件:Assertions.java   
/**
 * Ensures that a string passed as an argument to the calling method is not null or 0-length.
 *
 * @param string A string.
 * @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;
}
项目:android-exoplayer    文件:Assertions.java   
/**
 * Ensures that a string passed as an argument to the calling method is not null or 0-length.
 *
 * @param string A string.
 * @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;
}
项目:Exoplayer_VLC    文件:Assertions.java   
/**
 * Ensures that an object reference is not null.
 *
 * @param reference An object 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;
}