StreamingSource Class

Inheritance diagram of StreamingSource

class StreamingSource

A source that is decoded as it is being played, and can only be queued once.

Methods:

get_animation() Import all video frames into memory as an Animation.
get_audio_data(bytes) Get next packet of audio data.
get_next_video_frame() Get the next video frame.
get_next_video_timestamp() Get the timestamp of the next video frame.
play() Play the source.
seek(timestamp) Seek to given timestamp.

Attributes:

audio_format
duration The length of the source, in seconds.
info
is_queued Determine if this source has been queued
video_format

Attributes

StreamingSource.is_queued

Determine if this source has been queued on a Player yet.

Read-only.

Type:bool

Inherited members

Methods

StreamingSource.get_animation()

Import all video frames into memory as an Animation.

An empty animation will be returned if the source has no video. Otherwise, the animation will contain all unplayed video frames (the entire source, if it has not been queued on a player). After creating the animation, the source will be at EOS.

This method is unsuitable for videos running longer than a few seconds.

Note

Since pyglet 1.1

Return type:pyglet.image.Animation
StreamingSource.get_audio_data(bytes)

Get next packet of audio data.

Parameters:bytes (int) – Maximum number of bytes of data to return.
Return type:AudioData
Returns:Next packet of audio data, or None if there is no (more) data.
StreamingSource.get_next_video_frame()

Get the next video frame.

Video frames may share memory: the previous frame may be invalidated or corrupted when this method is called unless the application has made a copy of it.

Note

Since pyglet 1.1

Return type:pyglet.image.AbstractImage
Returns:The next video frame image, or None if the video frame could not be decoded or there are no more video frames.
StreamingSource.get_next_video_timestamp()

Get the timestamp of the next video frame.

Note

Since pyglet 1.1

Return type:float
Returns:The next timestamp, or None if there are no more video frames.
StreamingSource.play()

Play the source.

This is a convenience method which creates a ManagedSoundPlayer for this source and plays it immediately.

Return type:ManagedSoundPlayer
StreamingSource.seek(timestamp)

Seek to given timestamp.

Attributes

StreamingSource.audio_format = None
StreamingSource.duration

The length of the source, in seconds.

Not all source durations can be determined; in this case the value is None.

Read-only.

Type:float
StreamingSource.info = None
StreamingSource.video_format = None

Table Of Contents

Previous topic

StaticSource Class

Next topic

VideoFormat Class