public void deleteMedia(int position) { final MediaWrapper media = mVideoAdapter.getItem(position); final String path = media.getUri().getPath(); new Thread( new Runnable() { public void run() { Util.recursiveDelete(VLCApplication.getAppContext(), new File(path)); } }) .start(); mMediaLibrary.getMediaItems().remove(media); mVideoAdapter.remove(media); PlaybackServiceClient.getMediaLocations( getActivity(), new PlaybackServiceClient.ResultCallback<List<String>>() { @Override public void onResult(PlaybackServiceClient client, List<String> result) { if (result != null && result.contains(media.getLocation())) client.removeLocation(media.getLocation()); } @Override public void onError(PlaybackServiceClient client) {} }); }
protected void playAudio(MediaWrapper media) { PlaybackServiceClient.load(getActivity(), null, media, true); }