MediaPlayerBox should have a start_position, end_position and an "end-reached" signal

Bug #838559 reported by Jo-Erlend Schinstad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quickly Widgets
New
Undecided
Unassigned

Bug Description

It should be possible to set a starting and ending position of the media being played. We should also be able to react to the end of the media. For instance, this would make it very easy to implement a loop function. Or you could have "bookmarks" in a media player, with a list of highlights to jump to. I'm thinking it should work something like this for a looper:

import gtk
from quickly.widgets.media_player_box import MediaPlayerBox

# Loops a media sequence
def end_reached(widget, data=None):
    widget.position = widget.start_position
    widget.play()

win = gtk.Window()
win.set_title("Medialooper")

player = MediaPlayerBox()
player.start_position = 100
player.end_position = 150
player.connect("end-reached", end_reached)
player.uri = "somefile.ogg"
win.add(player)
win.show_all()
player.play()

gtk.main()

The end-reached signal could also be used for something like a "play again" button.

summary: - MediaPlayerBox should have a set_start_position, set_end_position and an
- "end-reached" signal
+ MediaPlayerBox should have a start_position, end_position and an "end-
+ reached" signal
description: updated
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

I think these are all already taken care of, though not simply.

 - There already is an "end-of-file" signal which is set up for exactly your setting up looping and going to the next tracj.
 - You can set the "seek" position very easily.
 - You can get ahold of the slider in the player, and set the range, attach to events on it, poll the position, etc...

So, you can do what you suggest already, but it might be nice though to:
 - offer a convenience function like
player.set_range(start,stop)
These could take -1 for either slot, which would mean just start at the beginning or the end.
Then we would have to decide if we want a different signal as you suggest, or to change the name of the existing signal to cover the scenario.

I wonder if a signal for a certain position reached in the media might be nice.

player.signal_at_position(time, callback)

then you wouldn't have to poll to do things at different times.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.