[gtk/wip/otte/lottie: 3/86] video: When autoplaying, start playing once the video is prepared




commit d6f288427a70c72586b8960bef7b48dce7f83e39
Author: Benjamin Otte <otte redhat com>
Date:   Wed Dec 16 02:22:26 2020 +0100

    video: When autoplaying, start playing once the video is prepared
    
    This fixe video sources with longer loading times not automatically
    playing.

 gtk/gtkvideo.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gtk/gtkvideo.c b/gtk/gtkvideo.c
index 9f3eb43d94..d2cb23321a 100644
--- a/gtk/gtkvideo.c
+++ b/gtk/gtkvideo.c
@@ -545,6 +545,11 @@ gtk_video_notify_cb (GtkMediaStream *stream,
     gtk_video_update_error (self);
   if (g_str_equal (pspec->name, "playing"))
     gtk_video_update_playing (self);
+  if (g_str_equal (pspec->name, "prepared"))
+    {
+      if (self->autoplay && gtk_media_stream_is_prepared (stream))
+        gtk_media_stream_play (stream);
+    }
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]