sairam kumar :
Error:
[ERROR ] [Image ] Error loading texture somevideo.mpg
Actual Result:
- The error is caused and I am not able to use any of the attributes except
play()
The code for reference:
from functools import partial
from kivy.clock import Clock
from kivy.uix.video import Video
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.app import App
class VideoPlayScreen(Screen):
def __init__(self, **kwargs):
super(VideoPlayScreen, self).__init__(**kwargs)
box_layout = BoxLayout()
self.video1 = Video(source="cityCC0.mpg")
box_layout.add_widget(self.video1)
self.add_widget(box_layout)
def on_enter(self, *args):
print(self.video1.state)
self.video1.state = "play"
print(self.video1.state)
Clock.schedule_interval(partial(print, self.video1.loaded), 0.5)
sm = ScreenManager()
sm.add_widget(VideoPlayScreen(name="video_play"))
sm.current = "video_play"
class OpenCity(App):
def build(self):
return sm
if __name__ == '__main__':
OpenCity().run()
The cityCC1.mpg is given by kivy. Check it in the kivy_examples folder.
RunLog:
[INFO ] [Logger ] Record log in C:\Users\kanna\.kivy\logs\kivy_20-03-01_28.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "F:\Python Kivy\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.7.6 (tags/v3.7.6:43364a7ae0, Dec 18 2019, 23:46:00) [MSC v.1916 32 bit (Intel)]
[INFO ] [Python ] Interpreter at "F:\Python Kivy\Scripts\python.exe"
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [ImageLoaderFFPy] Using ffpyplayer 4.3.0
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_ffpyplayer, img_gif (img_pil ignored)
[INFO ] [VideoGstplayer] Using Gstreamer 1.16.2.0
[INFO ] [Video ] Provider: gstplayer
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 - Build 26.20.100.7262'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) UHD Graphics 630'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 - Build 26.20.100.7262'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[ERROR ] [Image ] Error loading texture cityCC0.mpg
[INFO ] [Base ] Start application main loop
stop
play
False 0.9090554999999999
[INFO ] [GL ] NPOT texture support is available
False 0.5063968000000001
False 0.4993861999999998
False 0.49537330000000024
[INFO ] [WindowSDL ] exiting mainloop and closing.
[INFO ] [Base ] Leaving application in progress...
It shows the run log as code.
As always thanks for reading.
The question after this will get a link to the pastebin with the code log.
John Anderson :
According to the documentation, partial
“freezes” some portion of a function’s arguments
So that your print
function in the partial
is just printing the value of self.video1.loaded
as it was when the partial
function was called.
Here is a version of your posted code that prints the current version of loaded
every half second:
from kivy.clock import Clock
from kivy.uix.video import Video
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.app import App
class VideoPlayScreen(Screen):
def __init__(self, **kwargs):
super(VideoPlayScreen, self).__init__(**kwargs)
box_layout = BoxLayout()
self.video1 = Video(source="cityCC0.mpg")
box_layout.add_widget(self.video1)
self.add_widget(box_layout)
def on_enter(self, *args):
print(self.video1.state)
self.video1.state = "play"
print(self.video1.state)
Clock.schedule_interval(self.check_loaded, 0.5)
def check_loaded(self, dt):
print(self.video1.loaded)
sm = ScreenManager()
sm.add_widget(VideoPlayScreen(name="video_play"))
sm.current = "video_play"
class OpenCity(App):
def build(self):
return sm
if __name__ == '__main__':
OpenCity().run()
And the resulting output:
[ERROR ] [Image ] Error loading texture cityCC0.mpg
stop
play
[INFO ] [ProbeSysfs ] device match: /dev/input/event7
[INFO ] [MTD ] Read event from </dev/input/event7>
[INFO ] [ProbeSysfs ] device match: /dev/input/event4
[INFO ] [MTD ] Read event from </dev/input/event4>
[INFO ] [Base ] Start application main loop
[WARNING] [MTD ] Unable to open device "/dev/input/event7". Please ensure you have the appropriate permissions.
[WARNING] [MTD ] Unable to open device "/dev/input/event4". Please ensure you have the appropriate permissions.
False
[INFO ] [GL ] NPOT texture support is available
True
True
True
True