Posts: 1,665
Joined: Jun 2011
Reputation:
119
It's hard to tell without seeing the code but the issue but indeed you need to close your window first before starting video. As for why it stops, you need to show your code.
Posts: 60
Joined: Feb 2015
Reputation:
0
Here's the important parts....
class MyAddon(pyxbmct.AddonDialogWindow):
def __init__(self, title=''):
super(MyAddon, self).__init__(title)
self.setGeometry(1200, 450, 9, 5)
self.set_info_controls()
self.set_active_controls()
self.set_navigation()
# Connect a key action (Backspace) to close the window.
self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def set_info_controls(self):
global gameInfoArr
# Demo for PyXBMCt UI controls.
.
.
.
#
self.list_item_label = pyxbmct.Label('', textColor='0xFF808080')
self.placeControl(self.list_item_label, 4, 3)
# List
self.list = pyxbmct.List()
self.placeControl(self.list, 3, 4, 3, 1)
# Add items to the list
for mlink in gameInfoArr['linkitems']:
self.list.addItem(mlink['title'])
self.connect(self.list, lambda: self._play_video(gameInfoArr['linkitems'][self.list.getSelectedPosition()]['url']))
# Connect key and mouse events for list navigation feedback.
self.connectEventList(
[pyxbmct.ACTION_MOVE_DOWN,
pyxbmct.ACTION_MOVE_UP,
pyxbmct.ACTION_MOUSE_WHEEL_DOWN,
pyxbmct.ACTION_MOUSE_WHEEL_UP,
pyxbmct.ACTION_MOUSE_MOVE],
self.list_update)
.
.
.
# Button
self.button = pyxbmct.Button('Close')
self.placeControl(self.button, 8, 4)
# Connect control to close the window.
self.connect(self.button, self.close)
def set_navigation(self):
# Set navigation between controls
self.button.controlUp(self.slider)
self.button.controlDown(self.radiobutton)
self.radiobutton.controlUp(self.button)
self.radiobutton.controlDown(self.edit)
self.edit.controlUp(self.radiobutton)
self.edit.controlDown(self.list)
self.list.controlUp(self.edit)
self.list.controlDown(self.slider)
self.slider.controlUp(self.list)
self.slider.controlDown(self.button)
# Set initial focus
self.setFocus(self.radiobutton)
def list_update(self):
# Update list_item label when navigating through the list.
try:
if self.getFocus() == self.list:
self.list_item_label.setLabel(self.list.getListItem(self.list.getSelectedPosition()).getLabel())
else:
self.list_item_label.setLabel('')
except (RuntimeError, SystemError):
pass
def setAnimation(self, control):
# Set fade animation for all add-on window controls
control.setAnimations([('WindowOpen', 'effect=fade start=0 end=100 time=500',),
('WindowClose', 'effect=fade start=100 end=0 time=500',)])
def _play_video(self, url):
xbmc.Player().play(url)
xbmc.sleep(9000)
self.close()
.
.
.
def open_window(gameInfo):
.
.
.
window = MyAddon('Game Information')
window.doModal()
When I click on the list item, it will load the video and start playing behind the window, then about 9 seconds later the window closes and the video stops. If I don't put in the 9 second sleep, the window just closes and the video never starts. If I change it from AddonDialogWindow to AddonFullWindow, I get the error I mentioned earlier.
Thank you in advance for taking a look. Much appreciated!
Posts: 60
Joined: Feb 2015
Reputation:
0
In the code above, after the 9 second sleep, as soon as the window closes and video stops, this is what's in the log:
2023-05-10 18:03:13.906 T:16248 info <general>: CVideoPlayer::CloseFile()
2023-05-10 18:03:13.907 T:8856 info <general>: CVideoPlayer::OnExit()
2023-05-10 18:03:13.907 T:8856 info <general>: Closing stream player 1
2023-05-10 18:03:13.907 T:8856 info <general>: Waiting for audio thread to exit
2023-05-10 18:03:13.911 T:16248 info <general>: VideoPlayer: waiting for threads to exit
2023-05-10 18:03:13.919 T:9768 info <general>: thread end: CVideoPlayerAudio::OnExit()
Posts: 60
Joined: Feb 2015
Reputation:
0
I think I got it. I had set something to isPlayable to true when it should have been false. Thanks!
Posts: 60
Joined: Feb 2015
Reputation:
0
My ItemList was set for each item as isPlayable=true, but instead it actually launched a window, and in that window, a listitem would play a video. No that I set that to false, it works the way I want it to. In fact, I changed it to AddonFullWindow so that the window is still up when you exit the video. This works the way I want if I'm using it in Addons, my addon, and go through the items. If I add it to a widget in Actic Horizon 2 on the home screen, it hangs when I try to launch the window because apparently AH2 is considered a modal window. If I change it back to AddonDialogWindow, then the window loads, but launching the video hangs. I tried closing the window, sleeping for a number of seconds, then launching the video, but it still hangs because of 2 modal windows.
Posts: 9
Joined: Jan 2019
Reputation:
0
I see you said you found another way, I have also been curious about playing a video within the window, What way did you discover?
Posts: 18
Joined: Mar 2021
Reputation:
1
2023-12-04, 12:36
(This post was last modified: 2023-12-04, 12:36 by caperucitaferoz. Edited 1 time in total.)
Hello!
First of all I apologize if this has already been explained before, but I've been searching and haven't found it.
My question is simple, is there a multiline Edit control or an editable textbox? And if it does not exist, could this be implemented using Python in some way?
Thank you
Posts: 1,665
Joined: Jun 2011
Reputation:
119
Kodi does not have such control.