Added setting to toggle autoplaying of prim media, independent of parcel media. Audio autoplay also now yieds to sounds being stopped via nearby media panel.

This commit is contained in:
Shyotl
2013-07-11 20:53:12 -05:00
parent 8f3c1af82d
commit 6be6f488ba
8 changed files with 68 additions and 17 deletions

View File

@@ -10432,6 +10432,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>PrimMediaAutoPlayEnable</key>
<map>
<key>Comment</key>
<string>Auto play prim media when available</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>PerAccountSettingsFile</key>
<map>
<key>Comment</key>

View File

@@ -84,10 +84,11 @@ LLPanelNearByMedia::LLPanelNearByMedia(bool standalone_panel)
{
mHoverTimer.stop();
mParcelAudioAutoStart = gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay");
mParcelAudioAutoStart = gSavedSettings.getBOOL("MediaTentativeAutoPlay");
/*gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay");*/
gSavedSettings.getControl(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING)->getSignal()->connect(boost::bind(&LLPanelNearByMedia::handleMediaAutoPlayChanged, this, _2));
//gSavedSettings.getControl(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING)->getSignal()->connect(boost::bind(&LLPanelNearByMedia::handleMediaAutoPlayChanged, this, _2));
mCommitCallbackRegistrar.add("MediaListCtrl.EnableAll", boost::bind(&LLPanelNearByMedia::onClickEnableAll, this));
mCommitCallbackRegistrar.add("MediaListCtrl.DisableAll", boost::bind(&LLPanelNearByMedia::onClickDisableAll, this));
@@ -909,7 +910,7 @@ void LLPanelNearByMedia::onClickParcelAudioPlay()
}
else
{
gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL());
LLViewerParcelMedia::playStreamingMusic(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
}
@@ -1263,12 +1264,18 @@ void* createNearbyMediaPanel(void* userdata)
return new LLPanelNearByMedia(false);
}
LLFloaterNearbyMedia::LLFloaterNearbyMedia()
LLFloaterNearbyMedia::LLFloaterNearbyMedia() : mPanel(NULL)
{
mFactoryMap["nearby_media"] = LLCallbackMap(createNearbyMediaPanel, this);
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_nearby_media.xml",&mFactoryMap,false);
}
/*virtual*/ BOOL LLFloaterNearbyMedia::postBuild()
{
mPanel = getChild<LLPanelNearByMedia>("nearby_media",false,false);
return LLFloater::postBuild();
}
// static
void LLFloaterNearbyMedia::updateClass()
{

View File

@@ -189,10 +189,15 @@ public:
static void updateClass();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void onOpen();
virtual void handleReshape(const LLRect& new_rect, bool by_user);
LLPanelNearByMedia* getMediaPanel() { return mPanel; }
private:
LLPanelNearByMedia* mPanel;
};
#endif // LL_LLPANELNEARBYMEDIA_H

View File

@@ -87,6 +87,7 @@
std::string getProfileURL(const std::string& agent_name);
/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "ParcelMediaAutoPlayEnable";
/*static*/ const char* LLViewerMedia::AUTO_PLAY_PRIM_MEDIA_SETTING = "PrimMediaAutoPlayEnable";
/*static*/ const char* LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING = "MediaShowOnOthers";
/*static*/ const char* LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING = "MediaShowWithinParcel";
/*static*/ const char* LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING = "MediaShowOutsideParcel";
@@ -1103,7 +1104,7 @@ void LLViewerMedia::setAllMediaEnabled(bool val)
}
else
{
gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL());
LLViewerParcelMedia::playStreamingMusic(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
}
}
@@ -3857,9 +3858,19 @@ void LLViewerMediaImpl::setTextureID(LLUUID id)
//
bool LLViewerMediaImpl::isAutoPlayable() const
{
return (mMediaAutoPlay &&
gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay"));
static const LLCachedControl<bool> media_tentative_auto_play("MediaTentativeAutoPlay",false);
static const LLCachedControl<bool> auto_play_parcel_media(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING,false);
static const LLCachedControl<bool> auto_play_prim_media(LLViewerMedia::AUTO_PLAY_PRIM_MEDIA_SETTING,false);
if(mMediaAutoPlay && media_tentative_auto_play)
{
if(getUsedInUI())
return true;
else if(isParcelMedia() && auto_play_parcel_media)
return true;
else if(auto_play_prim_media)
return true;
}
return false;
}
//////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -84,6 +84,7 @@ public:
// String to get/set media autoplay in gSavedSettings
static const char* AUTO_PLAY_MEDIA_SETTING;
static const char* AUTO_PLAY_PRIM_MEDIA_SETTING;
static const char* SHOW_MEDIA_ON_OTHERS_SETTING;
static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING;
static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING;

View File

@@ -414,7 +414,7 @@ void LLViewerMediaFocus::update()
normal = mHoverObjectNormal;
}
if(media_impl && viewer_object)
if(media_impl && viewer_object && !media_impl->isForcedUnloaded())
{
// We have an object and impl to point at.

View File

@@ -55,6 +55,7 @@
#include "llfloaterbuyland.h"
#include "llfloatergroups.h"
//#include "llfloaterhtml.h"
#include "llpanelnearbymedia.h"
#include "llfloatersellland.h"
#include "llfloaterteleporthistory.h"
#include "llfloatertools.h"
@@ -1799,6 +1800,9 @@ void optionally_start_music(LLParcel* parcel)
{
if (gSavedSettings.getBOOL("AudioStreamingMusic"))
{
// Make the user click the start button on the overlay bar. JC
// llinfos << "Starting parcel music " << parcel->getMusicURL() << llendl;
@@ -1806,8 +1810,19 @@ void optionally_start_music(LLParcel* parcel)
// changed as part of SL-4878
if (gOverlayBar && gOverlayBar->musicPlaying())
{
LLViewerParcelMedia::playStreamingMusic(parcel);
LLPanelNearByMedia* nearby_media_panel = LLFloaterNearbyMedia::instanceExists() ? LLFloaterNearbyMedia::getInstance()->getMediaPanel() : NULL;
if ((nearby_media_panel &&
nearby_media_panel->getParcelAudioAutoStart()) ||
// or they have expressed no opinion in the UI, but have autoplay on...
(!nearby_media_panel &&
/*gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&*/
gSavedSettings.getBOOL("MediaTentativeAutoPlay")))
{
LLViewerParcelMedia::playStreamingMusic(parcel);
return;
}
}
gAudiop->startInternetStream(LLStringUtil::null);
}
}

View File

@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel border="true" bottom="-409" height="408" label="Audio &amp; Video" left="102" name="Media panel" width="517">
<text bottom="-22" height="12" left="10" name="muting_text">Volume:</text>
<text bottom="-215" name="streaming_prefs_text">Streaming Preferences:</text>
<text bottom="-300" height="12" name="audio_prefs_text">Audio Preferences:</text>
<panel border="true" bottom="-200" filename="panel_audio.xml" height="165" label="Volume" left="142" name="Volume Panel" width="260"/>
<check_box bottom="-220" control_name="AudioStreamingMusic" height="16" initial_value="true" label="Play Streaming Music When Available (uses more bandwidth)" left="142" name="streaming_music"/>
<text bottom="-190" name="streaming_prefs_text">Streaming Preferences:</text>
<text bottom="-295" height="12" name="audio_prefs_text">Audio Preferences:</text>
<panel border="true" bottom="-172" filename="panel_audio.xml" height="165" label="Volume" left="142" name="Volume Panel" width="260"/>
<check_box bottom="-195" control_name="MediaEnableFilter" follows="top" height="16" initial_value="true" label="Ask for permission (enables filtering)" left="142" name="media_filter_enable"/>
<check_box bottom_delta="-20" control_name="AudioStreamingMusic" follows="top" height="16" initial_value="true" label="Play Streaming Music When Available (uses more bandwidth)" name="streaming_music"/>
<check_box bottom_delta="-20" control_name="AudioStreamingMedia" follows="top" height="16" initial_value="true" label="Play Streaming Media When Available (uses more bandwidth)" name="streaming_video"/>
<check_box bottom_delta="-20" control_name="ParcelMediaAutoPlayEnable" follows="top" height="16" initial_value="true" label="Automatically play media" left="162" name="auto_streaming_video"/>
<check_box bottom_delta="-20" control_name="MediaEnableFilter" follows="top" height="16" initial_value="true" label="Ask for permission (enables filtering)" name="streaming_video"/>
<check_box bottom_delta="-20" control_name="PrimMediaAutoPlayEnable" follows="top" height="16" initial_value="true" label="Automatically play prim media" left="162" name="auto_prim_streaming_video"/>
<check_box bottom_delta="-20" control_name="ParcelMediaAutoPlayEnable" follows="top" height="16" initial_value="true" label="Automatically play parcel media" left="162" name="auto_streaming_video"/>
<check_box bottom_delta="-25" control_name="MuteWhenMinimized" follows="top" height="16" initial_value="true" label="Mute Audio When Window Minimized" left="142" name="mute_when_minimized"/>
<slider bottom_delta="-20" control_name="AudioLevelDoppler" edit_text="true" follows="top" height="15" increment="0.1" initial_val="1" label="Doppler Effect" label_width="130" left="148" max_val="2" min_val="0" name="Doppler Effect" show_text="true" width="300" />
<slider bottom_delta="-20" control_name="AudioLevelRolloff" edit_text="true" follows="top" height="15" increment="0.1" initial_val="1" label="Rolloff Factor (Default)" label_width="130" max_val="2" min_val="0" name="Rolloff Factor" width="300"/>