@Override
  protected Void doInBackground() throws Exception
  {

    currentPlayer = this;
    if (medias.length > 1)
      Gui.getInstance().getStopButton().setVisible(true);

    for (MediaElement item : medias)
    {
      if (cancelPlayer)
        break;

      if (!item.getVisible())
        continue;

      String name = item.getPath();

      item.setSeen(true);

      if (saver != null && !saver.isDone())
        saver.cancel(true);

      saver = new DatabaseSaver();
      saver.execute();

      if (cancelPlayer)
        break;

      try
      {
        if (System.getProperty("os.name").equals("Linux"))
        {
          final Process process = Runtime.getRuntime().exec(new String[]
          {
            "bash", "-c", "vlc \"" + name + "\""
                          + " vlc://exit --play-and-exit"
          });
          process.waitFor();
        }
        else
          Desktop.getDesktop().open(new File(name));
      } catch (IOException | InterruptedException exception)
      {
        System.err.println("Could not open: " + name + System.lineSeparator());
      }
    }
    return null;
  }