How to start to video in background of gui?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Ramses Offline
Junior Member
Posts: 1
Joined: Feb 2008
Reputation: 0
Post: #1
Hi,

I have a create a small test script, where I want the following functionality:
1) When the script launches, start xbmc.player with a streamed TV channel
2) Leave the video playing in the background, and continue with starting a small python script to do some action based on key pressed

This is my small script:
Quote:import xbmc, xbmcgui

#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10
ACTION_SELECT_ITEM = 7

class MyClass(xbmcgui.Window):

def __init__(self):
xbmc.Player().play('http://192.168.0.100:1234');

def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
if action == ACTION_SELECT_ITEM:
self.strAction = xbmcgui.ControlLabel(300, 200, 200, 200, "", "font14", "0xFF00FF00")
self.addControl(self.strAction)
self.strAction.setLabel("Hello world")

mydisplay = MyClass()
mydisplay.doModal()
del mydisplay

When I run this script I get a black screen, and the audio from the TV playing. My script is running, because I see a "Hello world" when I press the select button.
When I press the menu button, the video (streamed TV) will appear, but my own code is no longer running. (Pressing the select key will show mplayer info.).
Pressing the stop key stops the video playback, and return to the scripts menu page.

I have tried to start the xbmc.player in different ways, with the the command "xbmc.executescript('q:\\scripts\\showtv.py')", but then I only see the video, and my code is not running.
Pressing the stop key now, will start my code, and I can press the select key again to see the "Hello world" message.

Any ideas on how to have the video running in the background, and my code handle the keys pressed action, and display something on the screen ?
find quote
vinz973 Offline
Junior Member
Posts: 1
Joined: Feb 2008
Reputation: 0
Post: #2
import xbmc, xbmcgui

#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10
ACTION_SELECT_ITEM = 7

class MyClass(xbmcgui.WindowDialog):
def __init__(self):
xbmcgui.WindowDialog.__init__(self)
xbmc.Player().play('http://192.168.0.100:1234')
xbmc.executebuiltin('XBMC.ActivateWindow(2005)')

def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
if action == ACTION_SELECT_ITEM:
self.strAction = xbmcgui.ControlLabel(300, 200, 200, 200, "", "font14", "0xFF00FF00")
self.addControl(self.strAction)
self.strAction.setLabel("Hello world")

mydisplay = MyClass()
mydisplay.doModal()
del mydisplay
find quote