feat(src/components/sound-player/SoundPlayer): handle end of file

This commit is contained in:
Ronan Abhamon 2017-04-25 11:29:04 +02:00
parent 946651139e
commit b473902514
3 changed files with 27 additions and 1 deletions

View file

@ -37,6 +37,7 @@ public:
mAssistant = assistant;
}
private:
void onCreateAccount (
const shared_ptr<linphone::AccountCreator> &,
linphone::AccountCreatorStatus status,

View file

@ -25,10 +25,31 @@
#include "SoundPlayer.hpp"
using namespace std;
// =============================================================================
class SoundPlayer::Handlers : public linphone::PlayerListener {
public:
Handlers (SoundPlayer *soundPlayer) {
mSoundPlayer = soundPlayer;
}
private:
void onEofReached (const shared_ptr<linphone::Player> &) override {
mSoundPlayer->stop();
}
SoundPlayer *mSoundPlayer;
};
// -----------------------------------------------------------------------------
SoundPlayer::SoundPlayer (QObject *parent) : QObject(parent) {
mHandlers = make_shared<SoundPlayer::Handlers>(this);
mInternalPlayer = CoreManager::getInstance()->getCore()->createLocalPlayer("", "", nullptr);
mInternalPlayer->setListener(mHandlers);
}
// -----------------------------------------------------------------------------

View file

@ -34,6 +34,8 @@ namespace linphone {
}
class SoundPlayer : public QObject {
class Handlers;
Q_OBJECT;
Q_PROPERTY(QString source READ getSource WRITE setSource NOTIFY sourceChanged);
@ -81,9 +83,11 @@ private:
int getDuration () const;
std::shared_ptr<linphone::Player> mInternalPlayer;
QString mSource;
PlaybackState mPlaybackState = StoppedState;
std::shared_ptr<linphone::Player> mInternalPlayer;
std::shared_ptr<Handlers> mHandlers;
};
#endif // SOUND_PLAYER_H_