Planned maintenance: From Sunday 8th December 10:00 CET there will be changes to try and solve the caching issues that have been experienced. If anyone has a problem connecting after this period then please PM @AndyS or any of the moderators.

QMediaPlayer eats the initial part of audio files



  • Please, consider this short piece of code:

    QMediaPlayer *m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);
    m_player->setMedia(QUrl::fromLocalFile(filename));
    m_player->play();
    

    It plays a standard wave file (mono, 16 bit, 16 kHz) but you can't hear the first half of second of the audio. I need to play sound effects, which have a very short duration... is there a way to avoid QMediaPlayer "eating" the first part of the audio?


  • Lifetime Qt Champion

    Hi,

    Usually, to play sound effect, the QSoundEffect class is used. Wouldn't that fill your need ?