summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-07-09 00:42:44 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-07-09 00:42:44 +0300
commitff2721823fc091b3eccabba2886b90e30d9ec305 (patch)
treec8424f74a8e764bf28d78aa2db65d69e1ac6602b /indra
parentfa1ae9fa1adfdaaa79c3093cf628eb08a99575bb (diff)
SL-13579 Parcel media cannot be played if Media auto-play is set to No.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewerparcelaskplay.cpp2
-rw-r--r--indra/newview/llviewerparcelmedia.cpp38
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.cpp4
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.h3
4 files changed, 16 insertions, 31 deletions
diff --git a/indra/newview/llviewerparcelaskplay.cpp b/indra/newview/llviewerparcelaskplay.cpp
index d4aa783f12..74586dadc3 100644
--- a/indra/newview/llviewerparcelaskplay.cpp
+++ b/indra/newview/llviewerparcelaskplay.cpp
@@ -78,6 +78,8 @@ void LLViewerParcelAskPlay::askToPlay(const LLUUID &region_id, const S32 &parcel
default:
{
// create or re-create notification
+ // Note: will create and immediately cancel one notification if region has both media and music
+ // since ask play does not distinguish media from music and media can be used as music
cancelNotification();
if (LLStartUp::getStartupState() > STATE_PRECACHE)
diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp
index 0cdd447fcd..83b05e6b4d 100644
--- a/indra/newview/llviewerparcelmedia.cpp
+++ b/indra/newview/llviewerparcelmedia.cpp
@@ -52,6 +52,10 @@ mMediaParcelLocalID(0)
LLMessageSystem* msg = gMessageSystem;
msg->setHandlerFunc("ParcelMediaCommandMessage", parcelMediaCommandMessageHandler );
msg->setHandlerFunc("ParcelMediaUpdate", parcelMediaUpdateHandler );
+
+ // LLViewerParcelMediaAutoPlay will regularly check and autoplay media,
+ // might be good idea to just integrate it into LLViewerParcelMedia
+ LLSingleton<LLViewerParcelMediaAutoPlay>::getInstance();
}
LLViewerParcelMedia::~LLViewerParcelMedia()
@@ -80,11 +84,13 @@ void LLViewerParcelMedia::update(LLParcel* parcel)
S32 parcelid = parcel->getLocalID();
LLUUID regionid = gAgent.getRegion()->getRegionID();
+ bool location_changed = false;
if (parcelid != mMediaParcelLocalID || regionid != mMediaRegionID)
{
LL_DEBUGS("Media") << "New parcel, parcel id = " << parcelid << ", region id = " << regionid << LL_ENDL;
mMediaParcelLocalID = parcelid;
mMediaRegionID = regionid;
+ location_changed = true;
}
std::string mediaUrl = std::string ( parcel->getMediaURL () );
@@ -102,7 +108,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel)
if(mMediaImpl.isNull())
{
- play(parcel);
+ // media will be autoplayed by LLViewerParcelMediaAutoPlay
return;
}
@@ -111,8 +117,9 @@ void LLViewerParcelMedia::update(LLParcel* parcel)
|| ( mMediaImpl->getMediaTextureID() != parcel->getMediaID() )
|| ( mMediaImpl->getMimeType() != parcel->getMediaType() ))
{
- // Only play if the media types are the same.
- if(mMediaImpl->getMimeType() == parcel->getMediaType())
+ // Only play if the media types are the same and parcel stays same.
+ if(mMediaImpl->getMimeType() == parcel->getMediaType()
+ && !location_changed)
{
play(parcel);
}
@@ -128,25 +135,6 @@ void LLViewerParcelMedia::update(LLParcel* parcel)
stop();
}
}
- /*
- else
- {
- // no audio player, do a first use dialog if there is media here
- if (parcel)
- {
- std::string mediaUrl = std::string ( parcel->getMediaURL () );
- if (!mediaUrl.empty ())
- {
- if (gWarningSettings.getBOOL("QuickTimeInstalled"))
- {
- gWarningSettings.setBOOL("QuickTimeInstalled", FALSE);
-
- LLNotificationsUtil::add("NoQuickTime" );
- };
- }
- }
- }
- */
}
// static
@@ -159,12 +147,6 @@ void LLViewerParcelMedia::play(LLParcel* parcel)
if (!gSavedSettings.getBOOL("AudioStreamingMedia"))
return;
- // This test appears all over the code and really should be facotred out into a single
- // call that returns true/false (with option ask dialog) but that is outside of scope
- // for this work so we'll just directly.
- if (gSavedSettings.getS32("ParcelMediaAutoPlayEnable") == 0 )
- return;
-
std::string media_url = parcel->getMediaURL();
std::string media_current_url = parcel->getMediaCurrentURL();
std::string mime_type = parcel->getMediaType();
diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp
index 36c7d436f6..db8fcb4dc4 100644
--- a/indra/newview/llviewerparcelmediaautoplay.cpp
+++ b/indra/newview/llviewerparcelmediaautoplay.cpp
@@ -143,7 +143,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
LLViewerParcelAskPlay::getInstance()->askToPlay(this_region->getRegionID(),
this_parcel->getLocalID(),
this_parcel->getMediaURL(),
- onStartMusicResponse);
+ onStartMediaResponse);
break;
}
}
@@ -160,7 +160,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
}
//static
-void LLViewerParcelMediaAutoPlay::onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play)
+void LLViewerParcelMediaAutoPlay::onStartMediaResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play)
{
if (play)
{
diff --git a/indra/newview/llviewerparcelmediaautoplay.h b/indra/newview/llviewerparcelmediaautoplay.h
index cf8e9a97e7..d71fd4c075 100644
--- a/indra/newview/llviewerparcelmediaautoplay.h
+++ b/indra/newview/llviewerparcelmediaautoplay.h
@@ -39,7 +39,8 @@ public:
static void playStarted();
private:
- static void onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
+ // for askToPlay
+ static void onStartMediaResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
private:
S32 mLastParcelID;