diff options
Diffstat (limited to 'indra/newview/llviewermedia_streamingaudio.cpp')
-rw-r--r-- | indra/newview/llviewermedia_streamingaudio.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp index b68ffbe1a2..21f5ba64d7 100644 --- a/indra/newview/llviewermedia_streamingaudio.cpp +++ b/indra/newview/llviewermedia_streamingaudio.cpp @@ -34,6 +34,7 @@ #include "llmimetypes.h" #include "lldir.h" +#include "llnotificationmanager.h" LLStreamingAudio_MediaPlugins::LLStreamingAudio_MediaPlugins() : mMediaPlugin(NULL), @@ -111,6 +112,8 @@ void LLStreamingAudio_MediaPlugins::update() mMediaPlugin->idle(); } +extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); + int LLStreamingAudio_MediaPlugins::isPlaying() { if (!mMediaPlugin) @@ -118,6 +121,21 @@ int LLStreamingAudio_MediaPlugins::isPlaying() LLPluginClassMediaOwner::EMediaStatus status = mMediaPlugin->getStatus(); + auto nowPlaying = mMediaPlugin->getMediaNowPlaying(); + if (!nowPlaying.empty() && mNowPlaying != nowPlaying) + { + mTitle = mMediaPlugin->getMediaTitle(); + mNowPlaying = nowPlaying; + auto text = llformat("Now playing %s.", nowPlaying.c_str()); + LLChat chat{text}; + chat.mFromName = mTitle; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, LLSD{}); + if (gSavedSettings.getBOOL("StreamNotificationChannelEnabled")) + { + send_chat_from_viewer(text, CHAT_TYPE_NORMAL, gSavedSettings.getS32("StreamNotificationChannel")); + } + } switch (status) { |