Class: Gtk::MediaStream

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Direct Known Subclasses

MediaFile

Instance Method Summary collapse

Instance Method Details

#durationInteger

The stream's duration in microseconds or 0 if unknown.

Returns:

  • (Integer)

    duration

#duration=(duration) ⇒ Integer

The stream's duration in microseconds or 0 if unknown.

Parameters:

  • duration (Integer)

Returns:

  • (Integer)

    duration

  • (Integer)

    duration

#endedBoolean

Returns whether the streams playback is finished.

Returns:

  • (Boolean)

    true if playback is finished

#ended=(ended) ⇒ Boolean

Set when playback has finished.

Parameters:

  • ended (Boolean)

Returns:

  • (Boolean)

    ended

  • (Boolean)

    ended

#ended?Boolean

Set when playback has finished.

Returns:

  • (Boolean)

    ended

#errorGLib::Error

nil for a properly working stream or the GError that the stream is in.

Returns:

  • (GLib::Error)

    error

#error=(error) ⇒ GLib::Error

nil for a properly working stream or the GError that the stream is in.

Parameters:

  • error (GLib::Error)

Returns:

  • (GLib::Error)

    error

  • (GLib::Error)

    error

#error_valist(domain, code, format, args) ⇒ nil

Sets self into an error state using a printf()-style format string.

This is a utility function that calls [methodGtk.MediaStream.gerror]. See that function for details.

Parameters:

  • domain (GLib::Quark)

    error domain

  • code (Integer)

    error code

  • format (String)

    printf()-style format for error message

  • args (Gtk::va_list)

    va_list of parameters for the message format

Returns:

  • (nil)

#gerror(error) ⇒ nil

Sets self into an error state.

This will pause the stream (you can check for an error via [methodGtk.MediaStream.get_error] in your GtkMediaStream.pause() implementation), abort pending seeks and mark the stream as prepared.

if the stream is already in an error state, this call will be ignored and the existing error will be retained.

To unset an error, the stream must be reset via a call to [methodGtk.MediaStream.unprepared].

Parameters:

  • error (GLib::Error)

    the GError to set

Returns:

  • (nil)

#has_audioBoolean

Returns whether the stream has audio.

Returns:

  • (Boolean)

    true if the stream has audio

#has_audio=(has_audio) ⇒ Boolean

Whether the stream contains audio.

Parameters:

  • has_audio (Boolean)

Returns:

  • (Boolean)

    has-audio

  • (Boolean)

    has-audio

#has_audio?Boolean

Whether the stream contains audio.

Returns:

  • (Boolean)

    has-audio

#has_videoBoolean

Returns whether the stream has video.

Returns:

  • (Boolean)

    true if the stream has video

#has_video=(has_video) ⇒ Boolean

Whether the stream contains video.

Parameters:

  • has_video (Boolean)

Returns:

  • (Boolean)

    has-video

  • (Boolean)

    has-video

#has_video?Boolean

Whether the stream contains video.

Returns:

  • (Boolean)

    has-video

#is_preparedBoolean

Returns whether the stream has finished initializing.

At this point the existence of audio and video is known.

Returns:

  • (Boolean)

    true if the stream is prepared

#is_seekableBoolean

Checks if a stream may be seekable.

This is meant to be a hint. Streams may not allow seeking even if this function returns true. However, if this function returns false, streams are guaranteed to not be seekable and user interfaces may hide controls that allow seeking.

It is allowed to call [methodGtk.MediaStream.seek] on a non-seekable stream, though it will not do anything.

Returns:

  • (Boolean)

    true if the stream may support seeking

#is_seekingBoolean

Checks if there is currently a seek operation going on.

Returns:

  • (Boolean)

    true if a seek operation is ongoing.

#loopBoolean

Returns whether the stream is set to loop.

See [methodGtk.MediaStream.set_loop] for details.

Returns:

  • (Boolean)

    true if the stream should loop

#loop=(loop) ⇒ Boolean

Try to restart the media from the beginning once it ended.

Parameters:

  • loop (Boolean)

Returns:

  • (Boolean)

    loop

  • (Boolean)

    loop

#loop?Boolean

Try to restart the media from the beginning once it ended.

Returns:

  • (Boolean)

    loop

#mutedBoolean

Returns whether the audio for the stream is muted.

See [methodGtk.MediaStream.set_muted] for details.

Returns:

  • (Boolean)

    true if the stream is muted

#muted=(muted) ⇒ Boolean

Whether the audio stream should be muted.

Parameters:

  • muted (Boolean)

Returns:

  • (Boolean)

    muted

  • (Boolean)

    muted

#muted?Boolean

Whether the audio stream should be muted.

Returns:

  • (Boolean)

    muted

#pausenil

Pauses playback of the stream.

If the stream is not playing, do nothing.

Returns:

  • (nil)

#playnil

Starts playing the stream.

If the stream is in error or already playing, do nothing.

Returns:

  • (nil)

#playingBoolean

Return whether the stream is currently playing.

Returns:

  • (Boolean)

    true if the stream is playing

#playing=(playing) ⇒ Boolean

Whether the stream is currently playing.

Parameters:

  • playing (Boolean)

Returns:

  • (Boolean)

    playing

  • (Boolean)

    playing

#playing?Boolean

Whether the stream is currently playing.

Returns:

  • (Boolean)

    playing

#prepared(has_audio, has_video, seekable, duration) ⇒ nil

Same as gtk_media_stream_stream_prepared().

Parameters:

  • has_audio (Boolean)

    true if the stream should advertise audio support

  • has_video (Boolean)

    true if the stream should advertise video support

  • seekable (Boolean)

    true if the stream should advertise seekability

  • duration (Integer)

    The duration of the stream or 0 if unknown

Returns:

  • (nil)

#prepared=(prepared) ⇒ Boolean

Whether the stream has finished initializing and existence of audio and video is known.

Parameters:

  • prepared (Boolean)

Returns:

  • (Boolean)

    prepared

  • (Boolean)

    prepared

#prepared?Boolean

Whether the stream has finished initializing and existence of audio and video is known.

Returns:

  • (Boolean)

    prepared

#realize(surface) ⇒ nil

Called by users to attach the media stream to a GdkSurface they manage.

The stream can then access the resources of surface for its rendering purposes. In particular, media streams might want to create a GdkGLContext or sync to the GdkFrameClock.

Whoever calls this function is responsible for calling [methodGtk.MediaStream.unrealize] before either the stream or surface get destroyed.

Multiple calls to this function may happen from different users of the video, even with the same surface. Each of these calls must be followed by its own call to [methodGtk.MediaStream.unrealize].

It is not required to call this function to make a media stream work.

Parameters:

Returns:

  • (nil)

#seek(timestamp) ⇒ nil

Start a seek operation on self to timestamp.

If timestamp is out of range, it will be clamped.

Seek operations may not finish instantly. While a seek operation is in process, the [propertyGtk.MediaStream:seeking] property will be set.

When calling gtk_media_stream_seek() during an ongoing seek operation, the new seek will override any pending seek.

Parameters:

  • timestamp (Integer)

    timestamp to seek to.

Returns:

  • (nil)

#seek_failednil

Ends a seek operation started via GtkMediaStream.seek() as a failure.

This will not cause an error on the stream and will assume that playback continues as if no seek had happened.

See [methodGtk.MediaStream.seek_success] for the other way of ending a seek.

Returns:

  • (nil)

#seek_successnil

Ends a seek operation started via GtkMediaStream.seek() successfully.

This function will unset the GtkMediaStream:ended property if it was set.

See [methodGtk.MediaStream.seek_failed] for the other way of ending a seek.

Returns:

  • (nil)

#seekable=(seekable) ⇒ Boolean

Set unless the stream is known to not support seeking.

Parameters:

  • seekable (Boolean)

Returns:

  • (Boolean)

    seekable

  • (Boolean)

    seekable

#seekable?Boolean

Set unless the stream is known to not support seeking.

Returns:

  • (Boolean)

    seekable

#seeking=(seeking) ⇒ Boolean

Set while a seek is in progress.

Parameters:

  • seeking (Boolean)

Returns:

  • (Boolean)

    seeking

  • (Boolean)

    seeking

#seeking?Boolean

Set while a seek is in progress.

Returns:

  • (Boolean)

    seeking

#stream_endednil

Pauses the media stream and marks it as ended.

This is a hint only, calls to [methodGtk.MediaStream.play] may still happen.

The media stream must be prepared when this function is called.

Returns:

  • (nil)

#stream_prepared(has_audio, has_video, seekable, duration) ⇒ nil

Called by GtkMediaStream implementations to advertise the stream being ready to play and providing details about the stream.

Note that the arguments are hints. If the stream implementation cannot determine the correct values, it is better to err on the side of caution and return true. User interfaces will use those values to determine what controls to show.

This function may not be called again until the stream has been reset via [methodGtk.MediaStream.stream_unprepared].

Parameters:

  • has_audio (Boolean)

    true if the stream should advertise audio support

  • has_video (Boolean)

    true if the stream should advertise video support

  • seekable (Boolean)

    true if the stream should advertise seekability

  • duration (Integer)

    The duration of the stream or 0 if unknown

Returns:

  • (nil)

#stream_unpreparednil

Resets a given media stream implementation.

[methodGtk.MediaStream.stream_prepared] can then be called again.

This function will also reset any error state the stream was in.

Returns:

  • (nil)

#timestampInteger

The current presentation timestamp in microseconds.

Returns:

  • (Integer)

    timestamp

#timestamp=(timestamp) ⇒ Integer

The current presentation timestamp in microseconds.

Parameters:

  • timestamp (Integer)

Returns:

  • (Integer)

    timestamp

  • (Integer)

    timestamp

#unpreparednil

Same as gtk_media_stream_stream_unprepared().

Returns:

  • (nil)

#unrealize(surface) ⇒ nil

Undoes a previous call to gtk_media_stream_realize().

This causes the stream to release all resources it had allocated from surface.

Parameters:

  • surface (Gdk::Surface)

    the GdkSurface the stream was realized with

Returns:

  • (nil)

#update(timestamp) ⇒ nil

Media stream implementations should regularly call this function to update the timestamp reported by the stream.

It is up to implementations to call this at the frequency they deem appropriate.

The media stream must be prepared when this function is called.

Parameters:

  • timestamp (Integer)

    the new timestamp

Returns:

  • (nil)

#volumeFloat

Volume of the audio stream.

Returns:

  • (Float)

    volume

#volume=(volume) ⇒ Float

Volume of the audio stream.

Parameters:

  • volume (Float)

Returns:

  • (Float)

    volume

  • (Float)

    volume