Skip to content

Instantly share code, notes, and snippets.

@laabroo
Last active December 16, 2015 02:29
Show Gist options
  • Save laabroo/0945ff215c48ba7ee0a7 to your computer and use it in GitHub Desktop.
Save laabroo/0945ff215c48ba7ee0a7 to your computer and use it in GitHub Desktop.
Implementation QMediaPlayer and QMediaPlaylist on Blackberry 10 development.
/*
Reffrence :
http://harmattan-dev.nokia.com/docs/library/html/qtmobility/qmediaplaylist.html
http://harmattan-dev.nokia.com/docs/library/html/qtmobility/qmediaplayer.html
*/
/*
on your file .pro
Please add this path declaration QMediaPlayer lib
CONFIG += mobility
MOBILITY = multimedia
QT += multimedia multimediakit
LIBS += -lbbmultimedia
*/
/*
on your file bar-description.xml
Please check permission "access_shared" to access file from your device or your path application
*/
#include <QMediaPlaylist>
#include <QMediaPlayer>
void MyPlayer::playSongs(){
QMediaPlayer player = new QMediaPlayer(this);
QMediaPlaylist playlist = new QMediaPlaylist(this);
playlist.addMedia(QUrl(YOUR_SONG_PATH+"song1.mp3"));
playlist.addMedia(QUrl(YOUR_SONG_PATH+"song2.mp3"));
playlist.addMedia(QUrl(YOUR_SONG_PATH+"song3.mp3"));
playlist.addMedia(QUrl(YOUR_SONG_PATH+"song4.mp3"));
playlist.addMedia(QUrl(YOUR_SONG_PATH+"song5.mp3"));
//replace YOUR_SONG_PATH to your really path songs
playlist.setCurrentPosition(0);
player.play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment