Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMultimedia

QMultimedia

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 221 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Imman_Manny
    wrote on last edited by
    #1

    error Mediaplayer.jpg

    Am trying to play the media player it showing only double Quote " " not playing the source file mp3 .

    Kindly help me !
    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    player= new QMediaPlayer(this);
    

    connect(player,&QMediaPlayer::positionChanged,this,&MainWindow::on_positionchanged);
    connect(player,&QMediaPlayer::durationChanged,this,&MainWindow::on_durationchanged);

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::on_Music_Slider_sliderMoved(int position)
    {
    player->setPosition(position);

    }

    void MainWindow::on_horizontalSlider_2_sliderMoved(int position)
    {
    player->setPosition(position);
    }

    void MainWindow::on_pushButton_clicked()
    {
    //load the file

    player->setSource(QUrl::fromLocalFile("qrc:/sou/dropit.mp3"));
    player->play();
    qDebug()<<player->errorString();
    

    }

    void MainWindow::on_pushButton_2_clicked()
    {
    player->stop();
    }

    void MainWindow::on_positionchanged(qint64 position)
    {
    ui->Music_Slider->setValue(position);
    }

    void MainWindow::on_durationchanged(qint64 position)
    {
    ui->Music_Slider->setMaximum(position);
    }

    • list item
    Christian EhrlicherC 1 Reply Last reply
    0
    • I Imman_Manny

      error Mediaplayer.jpg

      Am trying to play the media player it showing only double Quote " " not playing the source file mp3 .

      Kindly help me !
      MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
      , ui(new Ui::MainWindow)
      {
      ui->setupUi(this);

      player= new QMediaPlayer(this);
      

      connect(player,&QMediaPlayer::positionChanged,this,&MainWindow::on_positionchanged);
      connect(player,&QMediaPlayer::durationChanged,this,&MainWindow::on_durationchanged);

      }

      MainWindow::~MainWindow()
      {
      delete ui;
      }

      void MainWindow::on_Music_Slider_sliderMoved(int position)
      {
      player->setPosition(position);

      }

      void MainWindow::on_horizontalSlider_2_sliderMoved(int position)
      {
      player->setPosition(position);
      }

      void MainWindow::on_pushButton_clicked()
      {
      //load the file

      player->setSource(QUrl::fromLocalFile("qrc:/sou/dropit.mp3"));
      player->play();
      qDebug()<<player->errorString();
      

      }

      void MainWindow::on_pushButton_2_clicked()
      {
      player->stop();
      }

      void MainWindow::on_positionchanged(qint64 position)
      {
      ui->Music_Slider->setValue(position);
      }

      void MainWindow::on_durationchanged(qint64 position)
      {
      ui->Music_Slider->setMaximum(position);
      }

      • list item
      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Imman_Manny said in QMultimedia:

      QUrl::fromLocalFile("qrc:/sou/dropit.mp3")

      This is neither a local file nor a valid url.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved