简体   繁体   English

如何在Android QT中播放音频文件?

[英]How to play Audio file in Android QT?

i developed my application in QT, i am trying to port for android. 我在QT中开发了我的应用程序,我正在尝试移植到android。 my application working fine in android with few issues. 我的应用程序在android中工作正常,几乎没有问题。 the main issue is, i am not able to play the audio file when i am trying to put the audio file play Code i am getting error 主要问题是,当我尝试放置音频文件播放代码时,我无法播放音频文件我遇到错误

QSound::play(FilePath);

Error: : -1: error: error: cannot find -lQtMultimediaKit D:\\Projects\\test\\demo.cpp:996: error: undefined reference to 'QSound::play(QString const&)' 错误::-1:错误:错误:找不到-lQtMultimediaKit D:\\ Projects \\ test \\ demo.cpp:996:错误:对'QSound :: play(QString const&)的未定义引用

my config: QT 4.8,QT Creator 2.5.83 and necessitas and windows XP 我的配置:QT 4.8,QT Creator 2.5.83和必需品和Windows XP

i am able to include the QSound Header file and using intellisense to type the QSound::Play no issue while typing when i am getting error on compilation. 我能够包含QSound Header文件,并在使用编译出错时键入时使用intellisense键入QSound :: Play时没有问题。 so i tried to look into the source folder and i found QSound.h header also. 因此,我尝试查看源文件夹,并发现QSound.h标头。

How to play the Audio file in Android using QT? 如何使用QT在Android中播放音频文件?

in may case it works properly with no errors my code: 在可能的情况下,它可以正常工作,没有错误,我的代码:

player->setMedia(QUrl("qrc:/new/prefix1/1.mp3"));    
// ok it works on windows  
//also works on android

在搜索信息时迷迷糊糊地发现了这一点,这看起来很有用: http : //qt-project.org/doc/qt-5/qml-qtmultimedia-mediaplayer.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM