KDE 4.7 PyKDE API Reference

- KDE's Python API

# VideoPlayer Class Reference

`from PyKDE4.phonon import *`

Inherits: QWidget → QObject
Namespace: Phonon

## Detailed Description

\class VideoPlayer videoplayer.h phonon/VideoPlayer Playback class for simple tasks.

With %VideoPlayer you can get results quickly and easily. You can do the standard playback tasks like play, pause and stop, but also set a playback volume and seek (there's no guarantee that the seek will work, though).

Keep in mind that when the %VideoPlayer instance is deleted the playback will stop.

A play and forget code example:

     VideoPlayer *player = new VideoPlayer(parentWidget);
     connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
     player->play(url);

Author:
  Matthias Kretz <kretz@kde.org>

## Signals

| finished ()

## Methods

| __init__ (self, Phonon::Category category, QWidget parent=0)
| __init__ (self, QWidget parent=0)
Phonon.AudioOutput | audioOutput (self)
long | currentTime (self)
bool | event (self, QEvent a0)
bool | isPaused (self)
bool | isPlaying (self)
| load (self, Phonon.MediaSource source)
Phonon.MediaObject | mediaObject (self)
| pause (self)
| play (self, Phonon.MediaSource source)
| play (self)
| seek (self, long ms)
| setVolume (self, float volume)
| stop (self)
long | totalTime (self)
Phonon.VideoWidget | videoWidget (self)
float | volume (self)

## Signal Documentation

finished | ( |  | ) |

This signal is emitted when the playback finished.

Signal syntax:
  `QObject.connect(source, SIGNAL("finished()"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | Phonon::Category | category,
|  | QWidget | parent=0
| ) |  |  |

Constructs a new %VideoPlayer instance.

Parameters:

  | category | The category used for the audio output device.

Parameters:

  | parent | The QObject parent.

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Constructs a new video widget with a parent using Phonon.VideoCategory as its category.

Parameters:

  | parent | The QObject parent.

Phonon.AudioOutput audioOutput | ( |  | self ) |

getter for the AudioOutput.

long currentTime | ( |  | self ) |

Get the current time (in milliseconds) of the file currently being played.

bool event | ( | self, |
|  | QEvent | a0
| ) |  |  |

bool isPaused | ( |  | self ) |

Returns:
  true if it is currently paused

Returns:
  false if it is currently playing or stopped

bool isPlaying | ( |  | self ) |

Returns:
  true if it is currently playing

Returns:
  false if it is currently stopped or paused

load | ( | self, |
|  | Phonon.MediaSource | source
| ) |  |  |

Starts preloading the media data and fill audiobuffers in the backend.

When there's already a media playing (or paused) it will be stopped (the finished signal will not be emitted).

Phonon.MediaObject mediaObject | ( |  | self ) |

getter for the MediaObject.

pause | ( |  | self ) |

Pauses the playback.

play | ( | self, |
|  | Phonon.MediaSource | source
| ) |  |  |

Continues playback of a paused media. Restarts playback of a stopped media.

play | ( |  | self ) |

Continues playback of a paused media. Restarts playback of a stopped media.

seek | ( | self, |
|  | long | ms
| ) |  |  |

Seeks to the requested time. Note that the backend is free to ignore the seek request if the media source isn't seekable.

Parameters:

  | ms | Time in milliseconds from the start of the media.

setVolume | ( | self, |
|  | float | volume
| ) |  |  |

Sets the volume of the output as voltage factor.

1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%

stop | ( |  | self ) |

Stops the playback.

long totalTime | ( |  | self ) |

Get the total time (in milliseconds) of the file currently being played.

Phonon.VideoWidget videoWidget | ( |  | self ) |

getter for the VideoWidget.

float volume | ( |  | self ) |

This is the current volume of the output as voltage factor.

1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%