GtkMediaStream with gstreamer backend isn't 'prepared' until media is played
authorCaolán McNamara <caolanm@redhat.com>
Thu, 24 Feb 2022 19:44:08 +0000 (19:44 +0000)
committerCaolán McNamara <caolanm@redhat.com>
Wed, 9 Mar 2022 16:29:11 +0000 (16:29 +0000)
commit82f57c6a937a29911f879ffb9ef35eb1e1f48f46
tree772dc24a5bd26050c6fa0f30ce099468b1e07aa7
parentead210c17046c4ec6c6f0987f3707911e0de88ec
GtkMediaStream with gstreamer backend isn't 'prepared' until media is played

This seems to be a problem since:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3565

To demo the problem, the video demo in gtk4-demo is currently set to
autoplay, but it doesn't autoplay on load as expected because the
"prepared" notification doesn't fire until the user explicitly presses
play.

Similarly if the demo is tweaked to disable autoplay then on loading a
video (or an audio-only ogg) the duration is not known or shown until
the user presses play.

In LibreOffice we want to know what the size of the video is to position
it before the user can interact with it to set it to play. We can
workaround this to some degree by listening to "invalidate-size" on the
GtkMediaStream object which updates for videos, but that doesn't wor
for audio-only streams.

So restore listening to media-info-updated but ignore -1 (which I see
for audio-only where I get -1 and then a useful value) and 0 of the
original report.

see also:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3550

GNOME/gtk!4513
modules/media/gtkgstmediafile.c