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. Qmediaplayer still hates functioning
Forum Updated to NodeBB v4.3 + New Features

Qmediaplayer still hates functioning

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 258 Views 1 Watching
  • 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.
  • W Offline
    W Offline
    wiadro
    wrote on last edited by
    #1

    Hi all, i wrote the following code and there are no errors

    #include "mainwindow.h"
    #include <QApplication>
    #include <QMediaPlayer>
    #include <QAudioOutput>
    #include <QUrl>
    #include <QAudio>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    MainWindow w;
    
    
    QMediaPlayer* player = new QMediaPlayer;
    player->setSource(QUrl::fromLocalFile("/home/vboxuser/go.mp3"));
    
    
    QAudioOutput* audioOutput = new QAudioOutput();
    audioOutput->setVolume(0.5); // set the volume to 50%
    player->play();
    
    w.show();
    return a.exec();
    

    }
    but i hear no output when i run the program, this is the file location a0e2331f-a8e9-4359-8a8a-f9030867ffb4-image.png This is running on Debian, latest release, any ideas?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You forgot to call player->setAudioOutput(audioOutput);

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      W 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        You forgot to call player->setAudioOutput(audioOutput);

        W Offline
        W Offline
        wiadro
        wrote on last edited by
        #3

        @SGaist it worked, thank you for helping, it probably saved me hours...

        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