#ifndef MEDIAPARTICLEWIDGET_H
#define MEDIAPARTICLEWIDGET_H

#include <QWidget>

class QNetworkAccessManager;
class QVideoWidget;
class QMediaPlayer;
class QAudioOutput;
class QLabel;
struct Particle;

class MediaParticleWidget : public QWidget
{
  Q_OBJECT
public:
  explicit MediaParticleWidget(QWidget *parent = nullptr);

  void setParticle(const Particle *particle);
  void clear();

private:
  QNetworkAccessManager *m_nam;
  QVideoWidget *m_videoWidget;
  QMediaPlayer *m_player;
  QAudioOutput *m_audioOutput;
  QLabel *m_durationLabel;

  void fetchAndPlay(const QString &particleId);
};

#endif // MEDIAPARTICLEWIDGET_H
