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. Playing mp3 in a loop using Phonon
Forum Updated to NodeBB v4.3 + New Features

Playing mp3 in a loop using Phonon

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 4.3k 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.
  • A Offline
    A Offline
    Anticross
    wrote on last edited by
    #1

    I never use Phonon module in qt before. But now I have task to play mp3 file in infinite loop, till someone(I mean some Event, signal etc) stop it. I write the following code to play once:
    @m_mediaObject = new Phonon::MediaObject(this);
    m_audioOutput = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
    m_audioOutput->setVolume(0.5);

    Phonon::createPath(m_mediaObject, m_audioOutput);
    m_mediaObject->setCurrentSource(QString(":/Operator/Data/ring.mp3"));
    m_mediaObject->play();@

    I can make signal-slot connection with some end-file signal and start to play file again but is there any Phonon native solution ?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anticross
      wrote on last edited by
      #2

      I made the following : @ connect(m_mediaObject, SIGNAL(aboutToFinish()), this, SLOT(loopPlaying()));@
      and slot looks like this:
      @m_mediaObject->enqueue(Phonon::MediaSource(QString(":/Operator/Data/ring.mp3")));@
      Slots entered but nothing happens. If i replace enqueue by setCurentSource and Play all works but previous playing session don't reach it's end and interrupt. When I replace aboutToFinish signal by finished signal it even don't enters the slot.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anticross
        wrote on last edited by
        #3

        I tried to execute this code on another PC and it's work as I planing. It plays in a loop. But on my PC it plays only one time. All my PC and other use Windows XP Sp3 but I installed K-Lite codec pack on my PC.

        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