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(); } }
/** * 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); } }