summaryrefslogtreecommitdiff
path: root/indra/media_plugins
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-12-14 21:13:57 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-12-14 21:40:10 +0200
commite55a0510ff0146ec0f1ae60c8c97c3815ad5b0dd (patch)
treeb10c1b2c13c1450bc3d038dc71fea34f269b5161 /indra/media_plugins
parent3d96d00bceed452b696ee767ca5b9c9e1130485e (diff)
SL-16510 VLC time slider sometimes does not work
Diffstat (limited to 'indra/media_plugins')
-rw-r--r--indra/media_plugins/libvlc/media_plugin_libvlc.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index 1afe25e9a1..a49d99bb9b 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -93,8 +93,8 @@ private:
bool mIsLooping;
- float mCurTime;
- float mDuration;
+ F64 mCurTime;
+ F64 mDuration;
EStatus mVlcStatus;
};
@@ -606,11 +606,27 @@ 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);
- }
+ if (mLibVLCMediaPlayer)
+ {
+ libvlc_time_t time = 1000.0 * message_in.getValueReal("time");
+ libvlc_media_player_set_time(mLibVLCMediaPlayer, time);
+ time = libvlc_media_player_get_time(mLibVLCMediaPlayer);
+ if (time < 0)
+ {
+ // -1 if there is no media
+ mCurTime = 0;
+ }
+ else
+ {
+ mCurTime = (F64)time / 1000.0;
+ }
+
+ if (!libvlc_media_player_is_playing(mLibVLCMediaPlayer))
+ {
+ // if paused, won't trigger update, update now
+ setDirty(0, 0, mWidth, mHeight);
+ }
+ }
}
else if (message_name == "set_loop")
{