android打开wav声音
生活随笔
收集整理的這篇文章主要介紹了
android打开wav声音
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
從assets拷貝到手機(jī)上再打開才能成功
#define APP_TEMPPATH "/storage/emulated/0/fitness/"static int OpenSound(QMediaPlayer* &ply, QString qstrSound){ply = new QMediaPlayer();QFile dfile("assets:/"+qstrSound);if (dfile.exists()){QString path=APP_TEMPPATH+qstrSound;dfile.copy(path);QFile::setPermissions(path,QFile::WriteOwner | QFile::ReadOwner);ply->setMedia(QUrl::fromLocalFile(path));ply->setVolume(100);qDebug()<<qstrSound<<" sound copyed to phone:";return 0;}return -1;}
?
總結(jié)
以上是生活随笔為你收集整理的android打开wav声音的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: struts2 获得前端数据:
- 下一篇: 电子政务阶段测评3