diff options
Diffstat (limited to 'src/voip/CallManager.cpp')
-rw-r--r-- | src/voip/CallManager.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/voip/CallManager.cpp b/src/voip/CallManager.cpp index 993937f0..0ef14db9 100644 --- a/src/voip/CallManager.cpp +++ b/src/voip/CallManager.cpp @@ -10,7 +10,6 @@ #include <memory> #include <QGuiApplication> -#include <QMediaPlaylist> #include <QUrl> #include "Cache.h" @@ -42,9 +41,6 @@ extern "C" } #endif -Q_DECLARE_METATYPE(std::vector<mtx::events::voip::CallCandidates::Candidate>) -Q_DECLARE_METATYPE(mtx::events::voip::CallCandidates::Candidate) -Q_DECLARE_METATYPE(mtx::responses::TurnServer) using namespace mtx::events; using namespace mtx::events::voip; @@ -64,9 +60,6 @@ CallManager::CallManager(QObject *parent) , session_(WebRTCSession::instance()) , turnServerTimer_(this) { - qRegisterMetaType<std::vector<mtx::events::voip::CallCandidates::Candidate>>(); - qRegisterMetaType<mtx::events::voip::CallCandidates::Candidate>(); - qRegisterMetaType<mtx::responses::TurnServer>(); #ifdef GSTREAMER_AVAILABLE std::string errorMessage; @@ -180,11 +173,11 @@ CallManager::CallManager(QObject *parent) }); connect(&player_, - QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error), + &QMediaPlayer::error, this, - [this](QMediaPlayer::Error error) { + [this]() { stopRingtone(); - switch (error) { + switch (player_.error()) { case QMediaPlayer::FormatError: case QMediaPlayer::ResourceError: nhlog::ui()->error("WebRTC: valid ringtone file not found"); @@ -827,19 +820,17 @@ CallManager::retrieveTurnServer() void CallManager::playRingtone(const QUrl &ringtone, bool repeat) { - static QMediaPlaylist playlist; - playlist.clear(); - playlist.setPlaybackMode(repeat ? QMediaPlaylist::CurrentItemInLoop - : QMediaPlaylist::CurrentItemOnce); - playlist.addMedia(ringtone); - player_.setVolume(100); - player_.setPlaylist(&playlist); + player_.setLoops(repeat ? QMediaPlayer::Infinite : + 1); + player_.setSource(ringtone); + //player_.audioOutput()->setVolume(100); + player_.play(); } void CallManager::stopRingtone() { - player_.setPlaylist(nullptr); + player_.stop(); } bool |