Exemplo n.º 1
0
  public Media(String URI, int position) {
    mLocation = URI;

    LibVLC mLibVlc = null;
    try {
      mLibVlc = LibVLC.getInstance();
      mType = TYPE_ALL;

      TrackInfo[] tracks = mLibVlc.readTracksInfoPosition(position);

      extractTrackInfo(tracks);
    } catch (LibVlcException e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  /**
   * Create a new Media
   *
   * @param context Application context of the caller
   * @param media URI
   * @param addToDb Should it be added to the file database?
   */
  public Media(String URI, Boolean addToDb) {
    mLocation = URI;

    LibVLC mLibVlc = null;
    try {
      mLibVlc = LibVLC.getInstance();
      mType = TYPE_ALL;

      TrackInfo[] tracks = mLibVlc.readTracksInfo(mLocation);

      extractTrackInfo(tracks);
    } catch (LibVlcException e) {
      e.printStackTrace();
    }

    if (addToDb) {
      // Add this item to database
      DatabaseManager db = DatabaseManager.getInstance(VLCApplication.getAppContext());
      db.addMedia(this);
    }
  }