GtkVideo

GtkVideo — A widget for displaying video

Properties

gboolean autoplay Read / Write
GFile * file Read / Write
gboolean loop Read / Write
GtkMediaStream * media-stream Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkVideo

Implemented Interfaces

GtkVideo implements AtkImplementorIface, GtkBuildable and GtkConstraintTarget.

Includes

#include <gtk/gtk.h>

Description

GtkVideo is a widget to show a GtkMediaStream.

It is commonly combined with GtkMediaControls to give the user a way to control the playback.

Functions

gtk_video_new ()

GtkWidget *
gtk_video_new (void);

Creates a new empty GtkVideo.

Returns

a new GtkVideo


gtk_video_new_for_media_stream ()

GtkWidget *
gtk_video_new_for_media_stream (GtkMediaStream *stream);

Creates a GtkVideo to play back the given stream .

Parameters

stream

a GtkMediaStream.

[allow-none]

Returns

a new GtkVideo


gtk_video_new_for_file ()

GtkWidget *
gtk_video_new_for_file (GFile *file);

Creates a GtkVideo to play back the given file .

Parameters

file

a GFile.

[allow-none]

Returns

a new GtkVideo


gtk_video_new_for_filename ()

GtkWidget *
gtk_video_new_for_filename (const char *filename);

Creates a GtkVideo to play back the given filename .

This is a utility function that calls gtk_video_new_for_file(), See that function for details.

Parameters

filename

filename to play back.

[allow-none][type filename]

Returns

a new GtkVideo


gtk_video_new_for_resource ()

GtkWidget *
gtk_video_new_for_resource (const char *resource_path);

Creates a GtkVideo to play back the resource at the given resource_path .

This is a utility function that calls gtk_video_new_for_file(),

Parameters

resource_path

resource path to play back.

[allow-none]

Returns

a new GtkVideo


gtk_video_get_media_stream ()

GtkMediaStream *
gtk_video_get_media_stream (GtkVideo *self);

Gets the media stream managed by self or NULL if none.

Parameters

self

a GtkVideo

 

Returns

The media stream managed by self .

[nullable][transfer none]


gtk_video_set_media_stream ()

void
gtk_video_set_media_stream (GtkVideo *self,
                            GtkMediaStream *stream);

Sets the media stream to be played back. self will take full control of managing the media stream. If you want to manage a media stream yourself, consider using a GtkImage for display.

If you want to display a file, consider using gtk_video_set_file() instead.

Parameters

self

a GtkVideo

 

stream

The media stream to play or NULL to unset.

[allow-none]

gtk_video_get_file ()

GFile *
gtk_video_get_file (GtkVideo *self);

Gets the file played by self or NULL if not playing back a file.

Parameters

self

a GtkVideo

 

Returns

The file played by self .

[nullable][transfer none]


gtk_video_set_file ()

void
gtk_video_set_file (GtkVideo *self,
                    GFile *file);

Makes self play the given file .

Parameters

self

a GtkVideo

 

file

the file to play.

[allow-none]

gtk_video_set_filename ()

void
gtk_video_set_filename (GtkVideo *self,
                        const char *filename);

Makes self play the given filename .

This is a utility function that calls gtk_video_set_file(),

Parameters

self

a GtkVideo

 

filename

the filename to play.

[allow-none]

gtk_video_set_resource ()

void
gtk_video_set_resource (GtkVideo *self,
                        const char *resource_path);

Makes self play the resource at the given resource_path .

This is a utility function that calls gtk_video_set_file(),

Parameters

self

a GtkVideo

 

resource_path

the resource to set.

[allow-none]

gtk_video_get_autoplay ()

gboolean
gtk_video_get_autoplay (GtkVideo *self);

Returns TRUE if videos have been set to loop via gtk_video_set_loop().

Parameters

self

a GtkVideo

 

Returns

TRUE if streams should autoplay


gtk_video_set_autoplay ()

void
gtk_video_set_autoplay (GtkVideo *self,
                        gboolean autoplay);

Sets whether self automatically starts playback when it becomes visible or when a new file gets loaded.

Parameters

self

a GtkVideo

 

autoplay

whether media streams should autoplay

 

gtk_video_get_loop ()

gboolean
gtk_video_get_loop (GtkVideo *self);

Returns TRUE if videos have been set to loop via gtk_video_set_loop().

Parameters

self

a GtkVideo

 

Returns

TRUE if streams should loop


gtk_video_set_loop ()

void
gtk_video_set_loop (GtkVideo *self,
                    gboolean loop);

Sets whether new files loaded by self should be set to loop.

Parameters

self

a GtkVideo

 

loop

whether media streams should loop

 

Types and Values

GtkVideo

typedef struct _GtkVideo GtkVideo;

Property Details

The “autoplay” property

  “autoplay”                 gboolean

If the video should automatically begin playing.

Owner: GtkVideo

Flags: Read / Write

Default value: FALSE


The “file” property

  “file”                     GFile *

The file played by this video if the video is playing a file.

Owner: GtkVideo

Flags: Read / Write


The “loop” property

  “loop”                     gboolean

If new media files should be set to loop.

Owner: GtkVideo

Flags: Read / Write

Default value: FALSE


The “media-stream” property

  “media-stream”             GtkMediaStream *

The media-stream played

Owner: GtkVideo

Flags: Read / Write

See Also

GtkMediaControls