On Fri, 2009-09-11 at 11:42 +0800, peng tian wrote:
> Calling player.pause() before player.play() causes the play inprogress
> won't finish and the playback won't start,
> and the mplayer process won't start either.

Can you try this with popcorn2?  (It's in WIP/popcorn2)

It's not complete yet, but the architecture should be much cleaner.

In particular, in your example, the line where you have commented "this
line causes the problem" should, with popcorn2, raise an exception
because the player is not in the appropriate state for pause()
(STATE_PLAYING).  Also, player.resume() should raise because the player
is not in STATE_PAUSED.

The original kaa.popcorn tried to be clever in handling these various
scenarios (calling methods not appropriate for the given state), but, as
you can see, was not clever enough.

kaa.popcorn2 does what I think is much more sensible and raises when the
state doesn't make sense.


> Maybe we should prevent from calling the methods in this sequence, but
> the events usually come from user interface, one could occasionally
> press pause button before playback starts, and I think it's the
> player's responsibility to keep reliable and robust.

I disagree, as you've probably sorted out by now. :)  Quoting python
mantra: "Explicit is better than implicit."  Rather than having the
player deal with these situations, I'd prefer to see the caller check
the state:

        def user_clicked_pause_button():
           if player.state in (popcorn.STATE_PLAYING, popcorn.STATE_PAUSED):
              player.pause_toggle()


A proper UI would have the pause button disabled when the player isn't
in the appropriate states anyway, don't you think?

Thanks for your feedback.  If you have any more, especially about
popcorn2, please let me know.

Cheers,
Jason.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to