private void setContextMenuItems(Menu menu, MediaWrapper mediaWrapper) {
    long lastTime = mediaWrapper.getTime();
    if (lastTime > 0) menu.findItem(R.id.video_list_play_from_start).setVisible(true);

    boolean hasInfo = false;
    final Media media = new Media(VLCInstance.get(), mediaWrapper.getUri());
    media.parse();
    media.release();
    if (media.getMeta(Media.Meta.Title) != null) hasInfo = true;
    menu.findItem(R.id.video_list_info).setVisible(hasInfo);
    menu.findItem(R.id.video_list_delete)
        .setVisible(
            !AndroidUtil.isLolliPopOrLater()
                || mediaWrapper
                    .getLocation()
                    .startsWith("file://" + AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY));
  }
  public void setVideoPath(String path) {
    mCurrentVideoPath = path;

    if (nativeMode) {
      try {
        mVideoView.setVideoPath(path);
      } catch (IllegalStateException e) {
        TvApp.getApplication()
            .getLogger()
            .ErrorException("Unable to set video path.  Probably backing out.", e);
      }
    } else {
      mSurfaceHolder.setKeepScreenOn(true);

      mCurrentMedia = new Media(mLibVLC, Uri.parse(path));
      mCurrentMedia.parse();
      mVlcPlayer.setMedia(mCurrentMedia);

      mCurrentMedia.release();
    }
  }
Beispiel #3
0
 public void updateMeta(MediaPlayer mediaPlayer) {
   final Media media = mediaPlayer.getMedia();
   if (media == null) return;
   updateMeta(media);
   media.release();
 }