VideoProtocol

public protocol VideoProtocol : WidgetProtocol

GtkVideo is a widget to show a GtkMediaStream with media controls.

An example GtkVideo

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.

  • ptr

    Untyped pointer to the underlying GtkVideo instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • video_ptr Default implementation

    Typed pointer to the underlying GtkVideo instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkVideo instance.

    Declaration

    Swift

    var video_ptr: UnsafeMutablePointer<GtkVideo>! { get }
  • Required Initialiser for types conforming to VideoProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Video Class

  • Bind a VideoPropertyName source 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 : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a Video property

    Declaration

    Swift

    @inlinable
    func get(property: VideoPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    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

    property

    the property to get the value for

    Return Value

    the value of the named property

Video Class: VideoProtocol extension (methods and fields)

  • getAutoplay() Extension method

    Returns true if videos have been set to loop.

    Declaration

    Swift

    @inlinable
    func getAutoplay() -> Bool
  • getFile() Extension method

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

    Declaration

    Swift

    @inlinable
    func getFile() -> GIO.FileRef!
  • getLoop() Extension method

    Returns true if videos have been set to loop.

    Declaration

    Swift

    @inlinable
    func getLoop() -> Bool
  • getMediaStream() Extension method

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

    Declaration

    Swift

    @inlinable
    func getMediaStream() -> MediaStreamRef!
  • set(autoplay:) Extension method

    Sets whether self automatically 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 self play the given file.

    Declaration

    Swift

    @inlinable
    func set(file: GIO.FileRef? = nil)
  • set(file:) Extension method

    Makes self play the given file.

    Declaration

    Swift

    @inlinable
    func set<FileT>(file: FileT?) where FileT : FileProtocol
  • set(filename:) Extension method

    Makes self play the given filename.

    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 self should be set to loop.

    Declaration

    Swift

    @inlinable
    func set(loop: Bool)
  • setMedia(stream:) Extension method

    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 [classGtk.Picture] for display.

    If you want to display a file, consider using [methodGtk.Video.set_file] instead.

    Declaration

    Swift

    @inlinable
    func setMedia(stream: MediaStreamRef? = nil)
  • setMedia(stream:) Extension method

    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 [classGtk.Picture] for display.

    If you want to display a file, consider using [methodGtk.Video.set_file] instead.

    Declaration

    Swift

    @inlinable
    func setMedia<MediaStreamT>(stream: MediaStreamT?) where MediaStreamT : MediaStreamProtocol
  • setResource(resourcePath:) Extension method

    Makes self play the resource at the given resource_path.

    This is a utility function that calls [methodGtk.Video.set_file].

    Declaration

    Swift

    @inlinable
    func setResource(resourcePath: UnsafePointer<CChar>? = nil)
  • autoplay Extension method

    If the video should automatically begin playing.

    Declaration

    Swift

    @inlinable
    var autoplay: Bool { get nonmutating set }
  • file Extension method

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

    Declaration

    Swift

    @inlinable
    var file: GIO.FileRef! { get nonmutating set }
  • loop Extension method

    If new media files should be set to loop.

    Declaration

    Swift

    @inlinable
    var loop: Bool { get nonmutating set }
  • mediaStream Extension method

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

    Declaration

    Swift

    @inlinable
    var mediaStream: MediaStreamRef! { get nonmutating set }