2021-07-25, 21:10
Hi,
I created my first addon that provides a rudimentary picture-in-picture function:
https://github.com/mltobi/kodi-pip-addon
I tried to use setImage() function to reload an image file cyclically. This image file is always the same file and is updated by a ffmpeg process.
However that does not work because setImage() seems not to recognize that the content of the image has changed.
In order to get a kind of reload I use two overlapping image controls.
This is necessary in order to keep the image shown by the 2nd control when the 1st control is removed.
The removal is required to reload the same image file in order to show the new content.
Unfortunately, this leads sometimes to flickers during displaying the updated image.
And the frame rate is very limited due to time of adding and removing an image control.
Is there a more effective way to display and reload automatically an image file that changes its content and timestamp.
Here is the code part I use to add and remove the two overlapping image controls:
Thanks
tobi
I created my first addon that provides a rudimentary picture-in-picture function:
https://github.com/mltobi/kodi-pip-addon
I tried to use setImage() function to reload an image file cyclically. This image file is always the same file and is updated by a ffmpeg process.
However that does not work because setImage() seems not to recognize that the content of the image has changed.
In order to get a kind of reload I use two overlapping image controls.
This is necessary in order to keep the image shown by the 2nd control when the 1st control is removed.
The removal is required to reload the same image file in order to show the new content.
Unfortunately, this leads sometimes to flickers during displaying the updated image.
And the frame rate is very limited due to time of adding and removing an image control.
Is there a more effective way to display and reload automatically an image file that changes its content and timestamp.
Here is the code part I use to add and remove the two overlapping image controls:
python:
# remove 2nd image control
if self.img2:
self.winHdl.removeControl(self.imgHdl2)
del self.imgHdl2
self.img2 = False
# create 1st image control
self.imgHdl1 = xbmcgui.ControlImage(self.x, self.y, self.w, self.h, self.imagefile)
self.img1 = True
# add 1st control to windows handle
self.winHdl.addControl(self.imgHdl1)
# wait half frame rate
xbmc.sleep(500)
# create 2nd image control to overlap the 1st image control
self.imgHdl2 = xbmcgui.ControlImage(self.x, self.y, self.w, self.h, self.imagefile)
self.img2 = True
# add 2nd control to windows handle
self.winHdl.addControl(self.imgHdl2)
# remove 1st control
if self.img1:
self.winHdl.removeControl(self.imgHdl1)
del self.imgHdl1
self.img1 = False
# wait half frame rate
xbmc.sleep(500)
Thanks
tobi