Hello,

I'm trying to play various videos with kaa.popcorn one after each other.
I want also to start the next video when the user hits the spacebar.
With the mplayer backend it works but the window flickers between
videos. I've seen that the same behaviour is present in Freevo2 so I
think it's mplayer's fault.

I've tried then with the xine backend but I get the following traceback
randomly. Attached is the program I coded so far.

To run just do

    video2.py ~/videos/*.avi

and press spacebar to start watching the next video or get the traceback




2008-07-19 20:16:56,272 [ERROR] async(323): Unhandled InProgress
exception:
Traceback (most recent call last):
  File "../base/build/lib.linux-i686-2.5/kaa/notifier/coroutine.py",
line 206, in _step
  File "../base/build/lib.linux-i686-2.5/kaa/notifier/coroutine.py",
line 79, in _process
  File "/usr/lib/python2.5/site-packages/kaa/popcorn/generic.py", line
316, in open
    yield self._open(player)
AsyncException: Exception raised asynchronously; traceback follows:
  File "../base/build/lib.linux-i686-2.5/kaa/notifier/coroutine.py",
line 206, in _step
  File "../base/build/lib.linux-i686-2.5/kaa/notifier/coroutine.py",
line 80, in _process
  File "/usr/lib/python2.5/site-packages/kaa/popcorn/generic.py", line
287, in _open
    raise PlayerError("Forced player %s does not work", player)
PlayerError: ('Forced player %s does not work', 'xine')

#!/usr/bin/python

import sys
import logging

import kaa
import kaa.display
import kaa.popcorn
import kaa.input.stdin

def print_msg(msg):
    print '>', msg


class VideoPlayer:

	def __init__(self):

		self.BACKEND = 'xine'

		self.window = None
		self.player = None

		self.fnames = sys.argv[1:]

	def next(self, id):
		fname = self.fnames.pop(0)

		print 'play %s with %s' % (fname, id)

		self.player.open(fname, player=id)

		self.player.play()

		return True


	def handle_key(self, key, player):
		if key in ("enter"):
			self.player.pause_toggle()
		if key in ("space"):
			self.next(self.BACKEND)
		elif key == "q":
			self.player.stop()
			sys.exit(0)

	def run(self):
#		logging.getLogger('popcorn').setLevel(logging.INFO)
#		logging.getLogger('popcorn.child').setLevel(logging.DEBUG)

		self.window = kaa.display.X11Window(size = (800, 450), title = "Kaa Display Test")

		self.player = kaa.popcorn.Player(self.window)

		self.player.signals["start"].connect(self.window.show)
		self.player.signals["end"].connect(print_msg, 'playback end')
		self.player.signals["failed"].connect(print_msg, 'playback failed')

		kaa.signals["stdin_key_press_event"].connect(self.handle_key, self.player)
		if self.player.get_window():
			self.player.get_window().signals["key_press_event"].connect(self.handle_key, self.player)

		self.player.set_property('scale', kaa.popcorn.SCALE_KEEP)

		if self.fnames:

			kaa.OneShotTimer(self.next, self.BACKEND).start(0)

			kaa.main.run()


video = VideoPlayer()
video.run()

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to