Skip to content

Media changes including support for PRIM_MEDIA_FIRST_CLICK_INTERACT and HUD autoplay #3989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: release/2025.04
Choose a base branch
from
22 changes: 22 additions & 0 deletions indra/newview/app_settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16157,5 +16157,27 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>MediaAutoPlayHuds</key>
<map>
<key>Comment</key>
<string>Automatically play HUD media</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MediaFirstClickInteract</key>
<map>
<key>Comment</key>
<string>Controls media first click/hover interaction, works with PRIM_MEDIA_FIRST_CLICK_INTERACT : 0 - No interaction | 1 - HUDS only | 2 - Only own objects | 99 - Any object</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>
27 changes: 27 additions & 0 deletions indra/newview/lltoolpie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,33 @@ static void handle_click_action_play()
}
}

bool LLToolPie::shouldAllowFirstMediaInteraction(const LLPickInfo& pick)
{
if(!pick.getObject())
{
return false;
}

static LLCachedControl<S32> FirstClickPref(gSavedSettings, "MediaFirstClickInteract", 1);

// HUD attachments only
if(FirstClickPref == 1 && pick.getObject()->isHUDAttachment())
{
return true;
}
// Only own objects
if(FirstClickPref == 2 && pick.getObject()->permYouOwner())
{
return true;
}
// Any object
if(FirstClickPref == 99)
{
return true;
}
return false;
}

bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
{
//FIXME: how do we handle object in different parcel than us?
Expand Down
1 change: 1 addition & 0 deletions indra/newview/lltoolpie.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class LLToolPie : public LLTool, public LLSingleton<LLToolPie>
void showVisualContextMenuEffect();
ECursorType cursorFromObject(LLViewerObject* object);

bool shouldAllowFirstMediaInteraction(const LLPickInfo& info);
bool handleMediaClick(const LLPickInfo& info);
bool handleMediaDblClick(const LLPickInfo& info);
bool handleMediaHover(const LLPickInfo& info);
Expand Down
11 changes: 11 additions & 0 deletions indra/newview/llvovolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,17 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m
}
viewer_media_t media_impl = LLViewerMedia::getInstance()->updateMediaImpl(mep, previous_url, update_from_self);

static LLCachedControl<bool> media_autoplay_huds(gSavedSettings, "MediaAutoPlayHuds", true);
bool was_loaded = media_impl->hasMedia();
if (media_autoplay_huds && !was_loaded)
{
std::string url = mep->getCurrentURL();
if (media_impl->getCurrentMediaURL() != url)
{
media_impl->navigateTo(url, "", false, true);
}
}

addMediaImpl(media_impl, texture_index) ;
}
else
Expand Down
Loading
Loading