SL-16344 #2 Do not play media preview if not opened

meow-7.2.2
Andrey Kleshchev 2022-01-15 03:43:43 +02:00
parent 488fb8bab6
commit 1b929cb9a9
4 changed files with 20 additions and 13 deletions

View File

@ -156,6 +156,18 @@ void LLFloaterMediaSettings::apply()
}
}
////////////////////////////////////////////////////////////////////////////////
void LLFloaterMediaSettings::onOpen(const LLSD& key)
{
if (mPanelMediaSettingsGeneral)
{
// media is expensive, so only load it when nessesary.
// If we need to preload it, set volume to 0 and any pause
// if applicable, then unpause here
mPanelMediaSettingsGeneral->updateMediaPreview();
}
}
////////////////////////////////////////////////////////////////////////////////
void LLFloaterMediaSettings::onClose(bool app_quitting)
{

View File

@ -42,6 +42,7 @@ public:
~LLFloaterMediaSettings();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
static LLFloaterMediaSettings* getInstance();

View File

@ -1472,17 +1472,17 @@ void LLFloaterTools::navigateToTitleMedia( const std::string url )
else if (mTitleMedia)
{
LLPluginClassMedia* media_plugin = mTitleMedia->getMediaPlugin();
if ( media_plugin ) // Shouldn't this be after navigateTo creates plugin?
{
// if it's a movie, we don't want to hear it
media_plugin->setVolume( 0 );
};
// check if url changed or if we need a new media source
if (mTitleMedia->getCurrentNavUrl() != url || media_plugin == NULL)
{
mTitleMedia->navigateTo( url );
LLViewerMediaImpl* impl = LLViewerMedia::getInstance()->getMediaImplFromTextureID(mTitleMedia->getTextureID());
if (impl)
{
// if it's a page with a movie, we don't want to hear it
impl->setVolume(0);
};
}
// flag that we need to update the title (even if no request were made)

View File

@ -98,9 +98,6 @@ BOOL LLPanelMediaSettingsGeneral::postBuild()
childSetCommitCallback( LLMediaEntry::HOME_URL_KEY, onCommitHomeURL, this);
childSetCommitCallback( "current_url_reset_btn",onBtnResetCurrentUrl, this);
// interrogates controls and updates widgets as required
updateMediaPreview();
return true;
}
@ -313,9 +310,6 @@ void LLPanelMediaSettingsGeneral::initValues( void* userdata, const LLSD& _media
data_set[ i ].ctrl_ptr->setTentative( media_settings[ tentative_key ].asBoolean() );
};
};
// interrogates controls and updates widgets as required
self->updateMediaPreview();
}
////////////////////////////////////////////////////////////////////////////////