## ClutterMedia

ClutterMedia — An interface for controlling playback of media data.

## Synopsis

                        ClutterMedia;
                        ClutterMediaInterface;
    void                clutter_media_set_uri               (ClutterMedia *media,
                                                             const char *uri);
    const char *        clutter_media_get_uri               (ClutterMedia *media);
    void                clutter_media_set_playing           (ClutterMedia *media,
                                                             gboolean playing);
    gboolean            clutter_media_get_playing           (ClutterMedia *media);
    void                clutter_media_set_position          (ClutterMedia *media,
                                                             int position);
    int                 clutter_media_get_position          (ClutterMedia *media);
    void                clutter_media_set_volume            (ClutterMedia *media,
                                                             double volume);
    double              clutter_media_get_volume            (ClutterMedia *media);
    gboolean            clutter_media_get_can_seek          (ClutterMedia *media);
    int                 clutter_media_get_buffer_percent    (ClutterMedia *media);
    int                 clutter_media_get_duration          (ClutterMedia *media);
    void                clutter_media_set_filename          (ClutterMedia *media,
                                                             const gchar *filename);

## Object Hierarchy

      GInterface
       +----ClutterMedia

## Properties

      "buffer-percent"           gint                  : Read
      "can-seek"                 gboolean              : Read
      "duration"                 gint                  : Read
      "playing"                  gboolean              : Read / Write
      "position"                 gint                  : Read / Write
      "uri"                      gchar*                : Read / Write
      "volume"                   gdouble               : Read / Write

## Signals

      "eos"                                            : Run Last
      "error"                                          : Run Last

## Description

ClutterMedia is an interface for controlling playback of media sources.

It is not implemented inside Clutter, but other integration libraries like Clutter-GStreamer, implement it to offer a uniform API for applications.

ClutterMedia is available since Clutter 0.2

## Details

### ClutterMedia

    typedef struct _ClutterMedia ClutterMedia;

### ClutterMediaInterface

    typedef struct {
      GTypeInterface	    base_iface;
      void (*set_uri)           (ClutterMedia *media,
    			     const char   *uri);
      const char *(*get_uri)    (ClutterMedia *media);
      void (*set_playing)       (ClutterMedia *media,
    			     gboolean      playing);
      gboolean (*get_playing)   (ClutterMedia *media);
      void (*set_position)      (ClutterMedia *media,
    			     int           position);
      int (*get_position)       (ClutterMedia *media);
      void (*set_volume)        (ClutterMedia *media,
    			     double        volume);
      double (*get_volume)      (ClutterMedia *media);
      gboolean (*can_seek)      (ClutterMedia *media);
      int (*get_buffer_percent) (ClutterMedia *media);
      int (*get_duration)       (ClutterMedia *media);

      /* signals */
      void (* eos)                (ClutterMedia *media);
      void (* error)              (ClutterMedia *media,
    			       GError       *error);
    } ClutterMediaInterface;

### clutter_media_set_uri ()

    void                clutter_media_set_uri               (ClutterMedia *media,
                                                             const char *uri);

Sets the URI of `media` to `uri`.

`media` : | ClutterMedia object
`uri` : | URI

Since 0.2

### clutter_media_get_uri ()

    const char *        clutter_media_get_uri               (ClutterMedia *media);

Retrieves the URI from `media`.

`media` : | A ClutterMedia object
Returns : | The URI as a string.

Since 0.2

### clutter_media_set_playing ()

    void                clutter_media_set_playing           (ClutterMedia *media,
                                                             gboolean playing);

Starts or stops `media` playing.

`media` : | A ClutterMedia object
`playing` : | TRUE to start playing, FALSE to stop.

Since 0.2

### clutter_media_get_playing ()

    gboolean            clutter_media_get_playing           (ClutterMedia *media);

Retrieves the playing status of `media`.

`media` : | A ClutterMedia object
Returns : | `TRUE` if playing, `FALSE` if stopped.

Since 0.2

### clutter_media_set_position ()

    void                clutter_media_set_position          (ClutterMedia *media,
                                                             int position);

Sets the playback position of `media` to `position`.

`media` : | A ClutterMedia object
`position` : | The desired position.

Since 0.2

### clutter_media_get_position ()

    int                 clutter_media_get_position          (ClutterMedia *media);

Retrieves the position of `media`.

`media` : | A ClutterMedia object
Returns : | The playback position.

Since 0.2

### clutter_media_set_volume ()

    void                clutter_media_set_volume            (ClutterMedia *media,
                                                             double volume);

Sets the playback volume of `media` to `volume`.

`media` : | A ClutterMedia object
`volume` : | The volume as a double between 0.0 and 1.0

Since 0.2

### clutter_media_get_volume ()

    double              clutter_media_get_volume            (ClutterMedia *media);

Retrieves the playback volume of `media`.

`media` : | A ClutterMedia object
Returns : | The playback volume between 0.0 and 1.0

Since 0.2

### clutter_media_get_can_seek ()

    gboolean            clutter_media_get_can_seek          (ClutterMedia *media);

Retrieves whether `media` is seekable or not.

`media` : | A ClutterMedia object
Returns : | `TRUE` if `media` can seek, `FALSE` otherwise.

Since 0.2

### clutter_media_get_buffer_percent ()

    int                 clutter_media_get_buffer_percent    (ClutterMedia *media);

Retrieves the amount of the stream that is buffered.

`media` : | A ClutterMedia object
Returns : | percentage value

Since 0.2

### clutter_media_get_duration ()

    int                 clutter_media_get_duration          (ClutterMedia *media);

Retrieves the duration of the media stream that `media` represents.

`media` : | A ClutterMedia object
Returns : | The length of the media stream.

Since 0.2

### clutter_media_set_filename ()

    void                clutter_media_set_filename          (ClutterMedia *media,
                                                             const gchar *filename);

Sets the filename of the media source.

`media` : | A ClutterMedia object
`filename` : | A filename to media file.

Since 0.2

## Property Details

### The `"buffer-percent"` property

      "buffer-percent"           gint                  : Read

The percentage the current stream buffer is filled.

Allowed values: [0,100]

Default value: 0

### The `"can-seek"` property

      "can-seek"                 gboolean              : Read

TRUE if the current stream is seekable.

Default value: FALSE

### The `"duration"` property

      "duration"                 gint                  : Read

The duration of the current stream in seconds.

Allowed values: >= 0

Default value: 0

### The `"playing"` property

      "playing"                  gboolean              : Read / Write

TRUE if playing.

Default value: FALSE

### The `"position"` property

      "position"                 gint                  : Read / Write

The position in the current stream in seconds.

Allowed values: >= 0

Default value: 0

### The `"uri"` property

      "uri"                      gchar*                : Read / Write

The loaded URI.

Default value: NULL

### The `"volume"` property

      "volume"                   gdouble               : Read / Write

The audio volume.

Allowed values: [0,100]

Default value: 50

## Signal Details

### The `"eos"` signal

    void                user_function                      (ClutterMedia *media,
                                                            gpointer      user_data)      : Run Last

The ::eos signal is emitted each time the media stream ends.

`media` : | the ClutterMedia instance that received the signal
`user_data` : | user data set when the signal handler was connected.

Since 0.2

### The `"error"` signal

    void                user_function                      (ClutterMedia *media,
                                                            gpointer      error,
                                                            gpointer      user_data)      : Run Last

The ::error signal is emitted each time an error occurred.

`media` : | the ClutterMedia instance that received the signal
`error` : | the GError
`user_data` : | user data set when the signal handler was connected.

Since 0.2