gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Video

Contents

- Exported types
- Methods
  - getAutoplay
  - getFile
  - getGraphicsOffload
  - getLoop
  - getMediaStream
  - new
  - newForFile
  - newForFilename
  - newForMediaStream
  - newForResource
  - setAutoplay
  - setFile
  - setFilename
  - setGraphicsOffload
  - setLoop
  - setMediaStream
  - setResource
- Properties
  - autoplay
  - file
  - graphicsOffload
  - loop
  - mediaStream

Description

Shows a `GtkMediaStream` with media controls.

<picture> <source srcset="video-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkVideo" src="video.png"> </picture>

The controls are available separately as `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 `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 `Paintable` API and a media framework such as Gstreamer directly.

Synopsis

- newtype Video = Video (ManagedPtr Video)
- class (GObject o, IsDescendantOf Video o) => IsVideo o
- toVideo :: (MonadIO m, IsVideo o) => o -> m Video
- videoGetAutoplay :: (HasCallStack, MonadIO m, IsVideo a) => a -> m Bool
- videoGetFile :: (HasCallStack, MonadIO m, IsVideo a) => a -> m (Maybe File)
- videoGetGraphicsOffload :: (HasCallStack, MonadIO m, IsVideo a) => a -> m GraphicsOffloadEnabled
- videoGetLoop :: (HasCallStack, MonadIO m, IsVideo a) => a -> m Bool
- videoGetMediaStream :: (HasCallStack, MonadIO m, IsVideo a) => a -> m (Maybe MediaStream)
- videoNew :: (HasCallStack, MonadIO m) => m Video
- videoNewForFile :: (HasCallStack, MonadIO m, IsFile a) => Maybe a -> m Video
- videoNewForFilename :: (HasCallStack, MonadIO m) => Maybe [Char] -> m Video
- videoNewForMediaStream :: (HasCallStack, MonadIO m, IsMediaStream a) => Maybe a -> m Video
- videoNewForResource :: (HasCallStack, MonadIO m) => Maybe Text -> m Video
- videoSetAutoplay :: (HasCallStack, MonadIO m, IsVideo a) => a -> Bool -> m ()
- videoSetFile :: (HasCallStack, MonadIO m, IsVideo a, IsFile b) => a -> Maybe b -> m ()
- videoSetFilename :: (HasCallStack, MonadIO m, IsVideo a) => a -> Maybe [Char] -> m ()
- videoSetGraphicsOffload :: (HasCallStack, MonadIO m, IsVideo a) => a -> GraphicsOffloadEnabled -> m ()
- videoSetLoop :: (HasCallStack, MonadIO m, IsVideo a) => a -> Bool -> m ()
- videoSetMediaStream :: (HasCallStack, MonadIO m, IsVideo a, IsMediaStream b) => a -> Maybe b -> m ()
- videoSetResource :: (HasCallStack, MonadIO m, IsVideo a) => a -> Maybe Text -> m ()
- constructVideoAutoplay :: (IsVideo o, MonadIO m) => Bool -> m (GValueConstruct o)
- getVideoAutoplay :: (MonadIO m, IsVideo o) => o -> m Bool
- setVideoAutoplay :: (MonadIO m, IsVideo o) => o -> Bool -> m ()
- clearVideoFile :: (MonadIO m, IsVideo o) => o -> m ()
- constructVideoFile :: (IsVideo o, MonadIO m, IsFile a) => a -> m (GValueConstruct o)
- getVideoFile :: (MonadIO m, IsVideo o) => o -> m (Maybe File)
- setVideoFile :: (MonadIO m, IsVideo o, IsFile a) => o -> a -> m ()
- constructVideoGraphicsOffload :: (IsVideo o, MonadIO m) => GraphicsOffloadEnabled -> m (GValueConstruct o)
- getVideoGraphicsOffload :: (MonadIO m, IsVideo o) => o -> m GraphicsOffloadEnabled
- setVideoGraphicsOffload :: (MonadIO m, IsVideo o) => o -> GraphicsOffloadEnabled -> m ()
- constructVideoLoop :: (IsVideo o, MonadIO m) => Bool -> m (GValueConstruct o)
- getVideoLoop :: (MonadIO m, IsVideo o) => o -> m Bool
- setVideoLoop :: (MonadIO m, IsVideo o) => o -> Bool -> m ()
- clearVideoMediaStream :: (MonadIO m, IsVideo o) => o -> m ()
- constructVideoMediaStream :: (IsVideo o, MonadIO m, IsMediaStream a) => a -> m (GValueConstruct o)
- getVideoMediaStream :: (MonadIO m, IsVideo o) => o -> m (Maybe MediaStream)
- setVideoMediaStream :: (MonadIO m, IsVideo o, IsMediaStream a) => o -> a -> m ()

# Exported types

newtype Video Source #

Memory-managed wrapper type.

Constructors

Video (ManagedPtr Video) |

#### Instances

Instances details

Eq Video Source # |
Instance details Defined in GI.Gtk.Objects.Video Methods (==) :: Video -> Video -> Bool Source # (/=) :: Video -> Video -> Bool Source #
GObject Video Source # |
Instance details Defined in GI.Gtk.Objects.Video
ManagedPtrNewtype Video Source # |
Instance details Defined in GI.Gtk.Objects.Video Methods toManagedPtr :: Video -> ManagedPtr Video Source #
TypedObject Video Source # |
Instance details Defined in GI.Gtk.Objects.Video Methods glibType :: IO GType Source #
HasParentTypes Video Source # |
Instance details Defined in GI.Gtk.Objects.Video
IsGValue (Maybe Video) Source # | Convert `Video` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Video Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Video -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Video) Source #
type ParentTypes Video Source # |
Instance details Defined in GI.Gtk.Objects.Video type ParentTypes Video = '[Widget, Object, Accessible, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf Video o) => IsVideo o Source #

Type class for types which can be safely cast to `Video`, for instance with `toVideo`.

#### Instances

Instances details

(GObject o, IsDescendantOf Video o) => IsVideo o Source # |
Instance details Defined in GI.Gtk.Objects.Video

toVideo :: (MonadIO m, IsVideo o) => o -> m Video Source #

Cast to `Video`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getAutoplay, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFile, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getGraphicsOffload, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getLoop, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMediaStream, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setAutoplay, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFile, setFilename, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setGraphicsOffload, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setLoop, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMediaStream, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setResource, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible.

## getAutoplay

videoGetAutoplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> m Bool | Returns: `True` if streams should autoplay

Returns `True` if videos have been set to loop.

## getFile

videoGetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> m (Maybe File) | Returns: The file played by `self`

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

## getGraphicsOffload

videoGetGraphicsOffload Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> m GraphicsOffloadEnabled | Returns: the graphics offload status

Returns whether graphics offload is enabled.

See `GraphicsOffload` for more information on graphics offload.

Since: 4.14

## getLoop

videoGetLoop Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> m Bool | Returns: `True` if streams should loop

Returns `True` if videos have been set to loop.

## getMediaStream

videoGetMediaStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> m (Maybe MediaStream) | Returns: The media stream managed by `self`

Gets the media stream managed by `self` or `Nothing` if none.

## new

videoNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Video | Returns: a new `GtkVideo`

Creates a new empty `GtkVideo`.

## newForFile

videoNewForFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFile a) |
=> Maybe a | `file`: a `GFile`
-> m Video | Returns: a new `GtkVideo`

Creates a `GtkVideo` to play back the given `file`.

## newForFilename

videoNewForFilename Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe [Char] | `filename`: filename to play back
-> m Video | Returns: a new `GtkVideo`

Creates a `GtkVideo` to play back the given `filename`.

This is a utility function that calls `videoNewForFile`, See that function for details.

## newForMediaStream

videoNewForMediaStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsMediaStream a) |
=> Maybe a | `stream`: a `GtkMediaStream`
-> m Video | Returns: a new `GtkVideo`

Creates a `GtkVideo` to play back the given `stream`.

## newForResource

videoNewForResource Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Text | `resourcePath`: resource path to play back
-> m Video | Returns: a new `GtkVideo`

Creates a `GtkVideo` to play back the resource at the given `resourcePath`.

This is a utility function that calls `videoNewForFile`.

## setAutoplay

videoSetAutoplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> Bool | `autoplay`: whether media streams should autoplay
-> m () |

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

## setFile

videoSetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a, IsFile b) |
=> a | `self`: a `GtkVideo`
-> Maybe b | `file`: the file to play
-> m () |

Makes `self` play the given `file`.

## setFilename

videoSetFilename Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> Maybe [Char] | `filename`: the filename to play
-> m () |

Makes `self` play the given `filename`.

This is a utility function that calls `videoSetFile`,

## setGraphicsOffload

videoSetGraphicsOffload Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> GraphicsOffloadEnabled | `enabled`: the new graphics offload status
-> m () |

Sets whether to enable graphics offload.

See `GraphicsOffload` for more information on graphics offload.

Since: 4.14

## setLoop

videoSetLoop Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> Bool | `loop`: whether media streams should loop
-> m () |

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

## setMediaStream

videoSetMediaStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a, IsMediaStream b) |
=> a | `self`: a `GtkVideo`
-> Maybe b | `stream`: The media stream to play or `Nothing` to unset
-> m () |

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 `Picture` for display.

If you want to display a file, consider using `videoSetFile` instead.

## setResource

videoSetResource Source #

Arguments

:: (HasCallStack, MonadIO m, IsVideo a) |
=> a | `self`: a `GtkVideo`
-> Maybe Text | `resourcePath`: the resource to set
-> m () |

Makes `self` play the resource at the given `resourcePath`.

This is a utility function that calls `videoSetFile`.

# Properties

## autoplay

If the video should automatically begin playing.

constructVideoAutoplay :: (IsVideo o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`autoplay`” property. This is rarely needed directly, but it is used by `new`.

getVideoAutoplay :: (MonadIO m, IsVideo o) => o -> m Bool Source #

Get the value of the “`autoplay`” property. When overloading is enabled, this is equivalent to

    get video #autoplay

setVideoAutoplay :: (MonadIO m, IsVideo o) => o -> Bool -> m () Source #

Set the value of the “`autoplay`” property. When overloading is enabled, this is equivalent to

    set video [ #autoplay := value ]

## file

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

clearVideoFile :: (MonadIO m, IsVideo o) => o -> m () Source #

Set the value of the “`file`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #file

constructVideoFile :: (IsVideo o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`file`” property. This is rarely needed directly, but it is used by `new`.

getVideoFile :: (MonadIO m, IsVideo o) => o -> m (Maybe File) Source #

Get the value of the “`file`” property. When overloading is enabled, this is equivalent to

    get video #file

setVideoFile :: (MonadIO m, IsVideo o, IsFile a) => o -> a -> m () Source #

Set the value of the “`file`” property. When overloading is enabled, this is equivalent to

    set video [ #file := value ]

## graphicsOffload

Whether to enable graphics offload.

Since: 4.14

constructVideoGraphicsOffload :: (IsVideo o, MonadIO m) => GraphicsOffloadEnabled -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`graphics-offload`” property. This is rarely needed directly, but it is used by `new`.

getVideoGraphicsOffload :: (MonadIO m, IsVideo o) => o -> m GraphicsOffloadEnabled Source #

Get the value of the “`graphics-offload`” property. When overloading is enabled, this is equivalent to

    get video #graphicsOffload

setVideoGraphicsOffload :: (MonadIO m, IsVideo o) => o -> GraphicsOffloadEnabled -> m () Source #

Set the value of the “`graphics-offload`” property. When overloading is enabled, this is equivalent to

    set video [ #graphicsOffload := value ]

## loop

If new media files should be set to loop.

constructVideoLoop :: (IsVideo o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`loop`” property. This is rarely needed directly, but it is used by `new`.

getVideoLoop :: (MonadIO m, IsVideo o) => o -> m Bool Source #

Get the value of the “`loop`” property. When overloading is enabled, this is equivalent to

    get video #loop

setVideoLoop :: (MonadIO m, IsVideo o) => o -> Bool -> m () Source #

Set the value of the “`loop`” property. When overloading is enabled, this is equivalent to

    set video [ #loop := value ]

## mediaStream

The media-stream played

clearVideoMediaStream :: (MonadIO m, IsVideo o) => o -> m () Source #

Set the value of the “`media-stream`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #mediaStream

constructVideoMediaStream :: (IsVideo o, MonadIO m, IsMediaStream a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`media-stream`” property. This is rarely needed directly, but it is used by `new`.

getVideoMediaStream :: (MonadIO m, IsVideo o) => o -> m (Maybe MediaStream) Source #

Get the value of the “`media-stream`” property. When overloading is enabled, this is equivalent to

    get video #mediaStream

setVideoMediaStream :: (MonadIO m, IsVideo o, IsMediaStream a) => o -> a -> m () Source #

Set the value of the “`media-stream`” property. When overloading is enabled, this is equivalent to

    set video [ #mediaStream := value ]