From ff2721823fc091b3eccabba2886b90e30d9ec305 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Jul 2020 00:42:44 +0300 Subject: SL-13579 Parcel media cannot be played if Media auto-play is set to No. --- indra/newview/llviewerparcelmedia.cpp | 38 +++++++++-------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'indra/newview/llviewerparcelmedia.cpp') 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::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(); -- cgit v1.2.3