Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Unable to play audio from Qt

Unable to play audio from Qt

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 457 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.
  • J Offline
    J Offline
    jigarp
    wrote on last edited by
    #1

    Hello I'm using Qt 5.9.6 on beagleboard-x15

    I'm able to play audio using aplay <filepath.wav>
    aplay -l list my available soundcard
    While trying to play audio using Qt as provided on QMediaPlayer it is not playing
    Qt can detect my soundcard using below method

        foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
            qDebug() << "Device name: " << deviceInfo.deviceName() ;
        } 
        qDebug() << "Default Output" << QAudioDeviceInfo::defaultOutputDevice().deviceName();
    
    

    Where Default Output shows null

    Here is my method how i'm trying to play audio file

        tMediaPlayer = new QMediaPlayer(this);
    
        tMediaPlayer->setMedia(QUrl::fromLocalFile("file:/home/root/audio/instrument.wav"));
        connect(tMediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
        tMediaPlayer->setVolume(90);
        tMediaPlayer->play();
    

    Even tMediaPlayer->error() return NoError

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

      Hi,

      What if you remove the file: prefix ? There's no need for it, fromLocalFile takes a normal path.

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

      1 Reply Last reply
      1
      • J jigarp

        Hello I'm using Qt 5.9.6 on beagleboard-x15

        I'm able to play audio using aplay <filepath.wav>
        aplay -l list my available soundcard
        While trying to play audio using Qt as provided on QMediaPlayer it is not playing
        Qt can detect my soundcard using below method

            foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
                qDebug() << "Device name: " << deviceInfo.deviceName() ;
            } 
            qDebug() << "Default Output" << QAudioDeviceInfo::defaultOutputDevice().deviceName();
        
        

        Where Default Output shows null

        Here is my method how i'm trying to play audio file

            tMediaPlayer = new QMediaPlayer(this);
        
            tMediaPlayer->setMedia(QUrl::fromLocalFile("file:/home/root/audio/instrument.wav"));
            connect(tMediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
            tMediaPlayer->setVolume(90);
            tMediaPlayer->play();
        

        Even tMediaPlayer->error() return NoError

        A Offline
        A Offline
        anil_arise
        wrote on last edited by
        #3

        @jigarp Is Qmediaplayer play other format of audio example .mp3 on your system?

        1 Reply Last reply
        0

        • Login

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