QT: DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x8007007b ()

1

I am using Qt Version 5.14.1.

When I was trying to play a video(.mp3), the program stopped working

And given error is DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x8007007b ()

AudioPlayer::AudioPlayer(QObject *parent)
: QObject(parent)
, m_backgroundMusic(NULL)  //QMediaPlayer * m_backgroundMusic
{
    QUrl backgroundMusicUrl = QUrl::fromLocalFile(":/music/8bitDungeonLevel.mp3");

    if (QFile::exists(backgroundMusicUrl.toLocalFile()))
    {
        m_backgroundMusic = new QMediaPlayer(this);
        QMediaPlaylist * backgroundMusicList = new QMediaPlaylist();

        QMediaContent media(backgroundMusicUrl);
        backgroundMusicList->addMedia(media);
        backgroundMusicList->setCurrentIndex(0);

        backgroundMusicList->setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
        m_backgroundMusic->setPlaylist(backgroundMusicList);

    }
}


void AudioPlayer::startBGM()
{

    if (m_backgroundMusic)
    {
        qDebug() << m_backgroundMusic;
        m_backgroundMusic->play();
    }
}

the output as below

QMediaPlayer(0x3987eb0)
DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x8007007b ()

I search the Internet and add LAV Filters to QT installation directory , I also restart the computer but nothing changes.So how to fix it?

c++
qt
asked on Stack Overflow May 25, 2020 by Brian

2 Answers

0

Your path in QUrl::fromLocalFile(":/music/8bitDungeonLevel.mp3") appears to be off, AFIK there is no (at least not common) path naming scheme that uses : to begin paths.

UPDATE:

I was told that :/ refers to resources that have been compiled into a Qt application, I think using the Qt Resource Compiler (rcc)

answered on Stack Overflow May 25, 2020 by The Floating Brain • edited Jan 13, 2021 by The Floating Brain
0

Use this code to load mp3 from resources:

m_mediaPlayer.setMedia(QUrl("qrc:/Audio/MouseOver.mp3"));

(do no forget do delete fromLocalFile)

answered on Stack Overflow Jan 7, 2021 by 8Observer8

User contributions licensed under CC BY-SA 3.0