SL-13579 Parcel media cannot be played if Media auto-play is set to No.

master
Andrey Kleshchev 2020-07-09 00:42:44 +03:00
parent fa1ae9fa1a
commit ff2721823f
4 changed files with 16 additions and 31 deletions

View File

@ -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)

View File

@ -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();

View File

@ -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)
{

View File

@ -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;