VideoProtocol
public protocol VideoProtocol : WidgetProtocol
GtkVideo is a widget to show a GtkMediaStream with media controls.

The controls are available separately as [classGtk.MediaControls].
If you just want to display a video without controls, you can treat it
like any other paintable and for example put it into a [classGtk.Picture].
GtkVideo aims to cover use cases such as previews, embedded animations,
etc. It supports autoplay, looping, and simple media controls. It does
not have support for video overlays, multichannel audio, device
selection, or input. If you are writing a full-fledged video player,
you may want to use the [classGdk.Paintable] API and a media framework
such as Gstreamer directly.
The VideoProtocol protocol exposes the methods and properties of an underlying GtkVideo instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Video.
Alternatively, use VideoRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkVideoinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
video_ptrDefault implementationTyped pointer to the underlying
GtkVideoinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkVideoinstance.Declaration
Swift
var video_ptr: UnsafeMutablePointer<GtkVideo>! { get } -
Required Initialiser for types conforming to
VideoProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
VideoPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: VideoPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a Video property
Declaration
Swift
@inlinable func get(property: VideoPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a Video property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: VideoPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getAutoplay()Extension methodReturns
trueif videos have been set to loop.Declaration
Swift
@inlinable func getAutoplay() -> Bool -
getFile()Extension methodGets the file played by
selfornilif not playing back a file.Declaration
Swift
@inlinable func getFile() -> GIO.FileRef! -
getLoop()Extension methodReturns
trueif videos have been set to loop.Declaration
Swift
@inlinable func getLoop() -> Bool -
getMediaStream()Extension methodGets the media stream managed by
selfornilif none.Declaration
Swift
@inlinable func getMediaStream() -> MediaStreamRef! -
set(autoplay:Extension method) Sets whether
selfautomatically starts playback when it becomes visible or when a new file gets loaded.Declaration
Swift
@inlinable func set(autoplay: Bool) -
set(file:Extension method) Makes
selfplay the givenfile.Declaration
Swift
@inlinable func set(file: GIO.FileRef? = nil) -
set(file:Extension method) Makes
selfplay the givenfile.Declaration
Swift
@inlinable func set<FileT>(file: FileT?) where FileT : FileProtocol -
set(filename:Extension method) Makes
selfplay the givenfilename.This is a utility function that calls
gtk_video_set_file(),Declaration
Swift
@inlinable func set(filename: UnsafePointer<CChar>? = nil) -
set(loop:Extension method) Sets whether new files loaded by
selfshould be set to loop.Declaration
Swift
@inlinable func set(loop: Bool) -
setMedia(stream:Extension method) Sets the media stream to be played back.
selfwill take full control of managing the media stream. If you want to manage a media stream yourself, consider using a [classGtk.Picture] for display.If you want to display a file, consider using [method
Gtk.Video.set_file] instead.Declaration
Swift
@inlinable func setMedia(stream: MediaStreamRef? = nil) -
setMedia(stream:Extension method) Sets the media stream to be played back.
selfwill take full control of managing the media stream. If you want to manage a media stream yourself, consider using a [classGtk.Picture] for display.If you want to display a file, consider using [method
Gtk.Video.set_file] instead.Declaration
Swift
@inlinable func setMedia<MediaStreamT>(stream: MediaStreamT?) where MediaStreamT : MediaStreamProtocol -
setResource(resourcePath:Extension method) Makes
selfplay the resource at the givenresource_path.This is a utility function that calls [method
Gtk.Video.set_file].Declaration
Swift
@inlinable func setResource(resourcePath: UnsafePointer<CChar>? = nil) -
autoplayExtension methodIf the video should automatically begin playing.
Declaration
Swift
@inlinable var autoplay: Bool { get nonmutating set } -
fileExtension methodThe file played by this video if the video is playing a file.
Declaration
Swift
@inlinable var file: GIO.FileRef! { get nonmutating set } -
loopExtension methodIf new media files should be set to loop.
Declaration
Swift
@inlinable var loop: Bool { get nonmutating set } -
mediaStreamExtension methodGets the media stream managed by
selfornilif none.Declaration
Swift
@inlinable var mediaStream: MediaStreamRef! { get nonmutating set }
View on GitHub
Install in Dash
VideoProtocol Protocol Reference