First pass at enabling time based media (videos) scrubbing controls
parent
befb0446c5
commit
8cd9569cef
|
|
@ -572,6 +572,11 @@ void MediaPluginLibVLC::receiveMessage(const char* message_string)
|
|||
}
|
||||
else if (message_name == "seek")
|
||||
{
|
||||
if (mDuration > 0)
|
||||
{
|
||||
F64 normalized_offset = message_in.getValueReal("time") / mDuration;
|
||||
libvlc_media_player_set_position(mLibVLCMediaPlayer, normalized_offset);
|
||||
}
|
||||
}
|
||||
else if (message_name == "set_loop")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
|
|||
mVolumeSliderVisible(0),
|
||||
mWindowShade(NULL),
|
||||
mHideImmediately(false),
|
||||
mSecureURL(false)
|
||||
mSecureURL(false),
|
||||
mMediaPlaySliderCtrlMouseDownValue(0.0)
|
||||
{
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
|
||||
|
|
@ -109,7 +110,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
|
|||
mCommitCallbackRegistrar.add("MediaCtrl.Open", boost::bind(&LLPanelPrimMediaControls::onClickOpen, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.Zoom", boost::bind(&LLPanelPrimMediaControls::onClickZoom, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.CommitURL", boost::bind(&LLPanelPrimMediaControls::onCommitURL, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.JumpProgress", boost::bind(&LLPanelPrimMediaControls::onCommitSlider, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.MouseDown", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.MouseUp", boost::bind(&LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this));
|
||||
mCommitCallbackRegistrar.add("MediaCtrl.Volume", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeSlider, this));
|
||||
|
|
@ -1246,26 +1248,38 @@ void LLPanelPrimMediaControls::setCurrentURL()
|
|||
#endif // USE_COMBO_BOX_FOR_MEDIA_URL
|
||||
}
|
||||
|
||||
void LLPanelPrimMediaControls::onCommitSlider()
|
||||
{
|
||||
focusOnTarget();
|
||||
|
||||
LLViewerMediaImpl* media_impl = getTargetMediaImpl();
|
||||
if (media_impl)
|
||||
void LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseDown()
|
||||
{
|
||||
mMediaPlaySliderCtrlMouseDownValue = mMediaPlaySliderCtrl->getValue().asReal();
|
||||
|
||||
mUpdateSlider = false;
|
||||
}
|
||||
|
||||
void LLPanelPrimMediaControls::onMediaPlaySliderCtrlMouseUp()
|
||||
{
|
||||
F64 cur_value = mMediaPlaySliderCtrl->getValue().asReal();
|
||||
|
||||
if (mMediaPlaySliderCtrlMouseDownValue != cur_value)
|
||||
{
|
||||
// get slider value
|
||||
F64 slider_value = mMediaPlaySliderCtrl->getValue().asReal();
|
||||
if(slider_value <= 0.0)
|
||||
{
|
||||
media_impl->stop();
|
||||
}
|
||||
else
|
||||
focusOnTarget();
|
||||
|
||||
LLViewerMediaImpl* media_impl = getTargetMediaImpl();
|
||||
if (media_impl)
|
||||
{
|
||||
media_impl->seek(slider_value*mMovieDuration);
|
||||
//mUpdateSlider= false;
|
||||
if (cur_value <= 0.0)
|
||||
{
|
||||
media_impl->stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
media_impl->seek(cur_value * mMovieDuration);
|
||||
}
|
||||
}
|
||||
|
||||
mUpdateSlider = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanelPrimMediaControls::onCommitVolumeUp()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -107,8 +107,10 @@ private:
|
|||
|
||||
void updateZoom();
|
||||
void setCurrentURL();
|
||||
void onCommitSlider();
|
||||
|
||||
|
||||
void onMediaPlaySliderCtrlMouseDown();
|
||||
void onMediaPlaySliderCtrlMouseUp();
|
||||
|
||||
void onCommitVolumeUp();
|
||||
void onCommitVolumeDown();
|
||||
void onCommitVolumeSlider();
|
||||
|
|
@ -219,6 +221,8 @@ private:
|
|||
S32 mVolumeSliderVisible;
|
||||
|
||||
LLNotificationPtr mActiveNotification;
|
||||
|
||||
F64 mMediaPlaySliderCtrlMouseDownValue;
|
||||
};
|
||||
|
||||
#endif // LL_PANELPRIMMEDIACONTROLS_H
|
||||
|
|
|
|||
|
|
@ -374,9 +374,11 @@
|
|||
layout="topleft"
|
||||
tool_tip="Movie play progress"
|
||||
width="200">
|
||||
<slider_bar.commit_callback
|
||||
function="MediaCtrl.JumpProgress" />
|
||||
</slider_bar>
|
||||
<slider_bar.mouse_down_callback
|
||||
function="MediaCtrl.MouseDown" />
|
||||
<slider_bar.mouse_up_callback
|
||||
function="MediaCtrl.MouseUp" />
|
||||
</slider_bar>
|
||||
</layout_panel>
|
||||
<layout_panel
|
||||
name="skip_back"
|
||||
|
|
|
|||
Loading…
Reference in New Issue