Android Open Source - glvideoplayer-android Video File Info






From Project

Back to project page glvideoplayer-android.

License

The source code is released under:

Apache License

If you think the Android project glvideoplayer-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.binzume.android.nicovideo;
/*from  w w  w .j  a  v  a 2 s .  com*/
import java.util.HashMap;

public class VideoFileInfo {
  public static final int MEDIA_UNKNOWN = -1;
  public static final int MEDIA_FLV = 0;
  public static final int MEDIA_MP4 = 1;
  public static final int MEDIA_SWF = 2;

  public static final int MEDIA_QUALITY_UNKNOWN = 0;
  public static final int MEDIA_QUALITY_LOW = 1;
  public static final int MEDIA_QUALITY_MID = 2;
  public static final int MEDIA_QUALITY_ORG = 4;

  public String videoId;
  public String url;
  public int length;
  public String cookie;
  public String errorCode;
  public ThreadInfo thread;
  public long optionThreadId;

  public VideoFileInfo() {

  }

  // from flvInfo
  public VideoFileInfo(HashMap<String, String> info) {
    try {
      length = Integer.parseInt(info.get("l"));
    } catch (NumberFormatException e) {
    }
    url = info.get("url");
    if (info.get("optional_thread_id") != null) {
      optionThreadId = Integer.parseInt(info.get("optional_thread_id"));
    }

    try {
      long threadId = Long.parseLong(info.get("thread_id"));
      thread = new ThreadInfo(threadId);
      thread.needsKey = "1".equals(info.get("needs_key"));
      thread.messageServerUrl = info.get("ms");
    } catch (NumberFormatException e) {
    }
    errorCode = info.get("error");
  }

  public int getMediaType() {
    if (url == null)
      return MEDIA_UNKNOWN;
    if (url.contains("?v="))
      return MEDIA_FLV;
    if (url.contains("?m="))
      return MEDIA_MP4;
    if (url.contains("?s="))
      return MEDIA_SWF;
    return MEDIA_UNKNOWN;
  }

  public String getThumbnailUrl() {
    if (url == null) {
      return null;
    }

    return url.replaceFirst(".*\\?.=(\\d+).*", "http://tn-skr.smilevideo.jp/smile?i=$1");
  }

  public int getMediaQuality() {
    if (url == null)
      return MEDIA_QUALITY_UNKNOWN;
    if (url.endsWith("low")) {
      return MEDIA_QUALITY_LOW;
    }
    if (url.endsWith("mid")) {
      return MEDIA_QUALITY_MID;
    }
    return MEDIA_QUALITY_ORG;
  }
}




Java Source Code List

net.binzume.android.glvideoplayer.DeviceCameraPlane.java
net.binzume.android.glvideoplayer.FBOTexture.java
net.binzume.android.glvideoplayer.GLShaderProgram.java
net.binzume.android.glvideoplayer.GLVideoRenderer.java
net.binzume.android.glvideoplayer.MainActivity.java
net.binzume.android.glvideoplayer.MediaPlayerPlane.java
net.binzume.android.glvideoplayer.NicoCommentPlane.java
net.binzume.android.glvideoplayer.OESTexture.java
net.binzume.android.glvideoplayer.TextureFactory.java
net.binzume.android.glvideoplayer.Texture.java
net.binzume.android.glvideoplayer.VideoSurfaceView.java
net.binzume.android.nicoplayer.player.CommentController.java
net.binzume.android.nicoplayer.player.CommentLoadTask.java
net.binzume.android.nicoplayer.player.CommentSlot.java
net.binzume.android.nicovideo.ChannelCategoryInfo.java
net.binzume.android.nicovideo.ChannelInfo.java
net.binzume.android.nicovideo.Comment.java
net.binzume.android.nicovideo.MyList.java
net.binzume.android.nicovideo.NicoSession.java
net.binzume.android.nicovideo.ThreadInfo.java
net.binzume.android.nicovideo.VideoFileInfo.java
net.binzume.android.nicovideo.VideoInfo.java
net.binzume.android.nicovideo.util.HtmlUtil.java
net.binzume.android.nicovideo.util.HttpClient.java
net.binzume.android.nicovideo.webapi.ChannelAPI.java
net.binzume.android.nicovideo.webapi.CommentAPI.java
net.binzume.android.nicovideo.webapi.Constants.java
net.binzume.android.nicovideo.webapi.FriendListAPI.java
net.binzume.android.nicovideo.webapi.LoginAPI.java
net.binzume.android.nicovideo.webapi.MyListAPI.java
net.binzume.android.nicovideo.webapi.NotLoginException.java
net.binzume.android.nicovideo.webapi.PaymentRequiredException.java
net.binzume.android.nicovideo.webapi.VideoAPI.java
net.binzume.android.nicovideo.webapi.VideoRssParser.java
net.binzume.android.nicovideo.webapi.VideoSearchAPI.java
net.binzume.android.nicovideo.webapi.WatchItemAPI.java
net.binzume.android.nicovideo.webapi.WebApiException.java