Commit b4739025 authored by Ronan Abhamon's avatar Ronan Abhamon

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

parent 94665113
......@@ -37,6 +37,7 @@ public:
mAssistant = assistant;
}
private:
void onCreateAccount (
const shared_ptr<linphone::AccountCreator> &,
linphone::AccountCreatorStatus status,
......
......@@ -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);
}
// -----------------------------------------------------------------------------
......
......@@ -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_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment