with your suggestions " The Video class is derived from Image, will display images and will accept a URL as a source. Just use the Video class. "
I made below class Video___(Video): to display images , Videos and to accept a URL as a source . it is displayng images from both url and local , but not Videos from both url and local .
app crashes when clicked on widget in all cases .
in case of video from url , i get below error and red cross mark displayed in place of video and no crash of app .
====================== loading error for Video from url ==========================
Traceback (most recent call last):
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/loader.py", line 376, in _load_urllib
data = self._load_local(_out_filename, kwargs)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/loader.py", line 304, in _load_local
return ImageLoader.load(filename, keep_data=True, **kwargs)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/core/image/__init__.py", line 463, in load
raise Exception('Unknown <%s> type, no loader found.' % ext)
Exception: Unknown <mp4> type, no loader found.
in case of video from local , i get below error and white space displayed in place of video and no crash of app .
======================== loadng error from Video from local ===========================
[ERROR ] [Image ] Error loading </home/purushottamdev/Pictures/VID_20210808_193912.mp4>
app crashes when clicked on widget in all cases .
============================= crash error in all cases on clicking on widget ======================
Traceback (most recent call last):
File "main.py", line 5084, in <module>
k.run()
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/app.py", line 950, in run
runTouchApp()
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 582, in runTouchApp
EventLoop.mainloop()
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 347, in mainloop
self.idle()
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 391, in idle
self.dispatch_input()
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 342, in dispatch_input
post_dispatch_input(*pop(0))
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 248, in post_dispatch_input
listener.dispatch('on_motion', etype, me)
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/core/window/__init__.py", line 1416, in on_motion
self.dispatch('on_touch_up', me)
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/core/window/__init__.py", line 1452, in on_touch_up
if w.dispatch('on_touch_up', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/modalview.py", line 284, in on_touch_up
super(ModalView, self).on_touch_up(touch)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 567, in on_touch_up
if child.dispatch('on_touch_up', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 567, in on_touch_up
if child.dispatch('on_touch_up', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 567, in on_touch_up
if child.dispatch('on_touch_up', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 567, in on_touch_up
if child.dispatch('on_touch_up', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "main.py", line 2629, in on_touch_up
return super().on_touch_up(touch)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/scrollview.py", line 950, in on_touch_up
if self.dispatch('on_scroll_stop', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "main.py", line 2597, in on_scroll_stop
return super().on_scroll_stop(touch)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/scrollview.py", line 989, in on_scroll_stop
self.simulate_touch_down(touch)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/scrollview.py", line 668, in simulate_touch_down
ret = super(ScrollView, self).on_touch_down(touch)
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 545, in on_touch_down
if child.dispatch('on_touch_down', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 545, in on_touch_down
if child.dispatch('on_touch_down', touch):
File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
File "main.py", line 2966, in on_touch_down
self.state = "play"
File "kivy/properties.pyx", line 498, in kivy.properties.Property.__set__
File "kivy/properties.pyx", line 545, in kivy.properties.Property.set
File "kivy/properties.pyx", line 600, in kivy.properties.Property.dispatch
File "kivy/_event.pyx", line 1248, in kivy._event.EventObservers.dispatch
File "kivy/_event.pyx", line 1154, in kivy._event.EventObservers._dispatch
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/video.py", line 207, in on_state
self._video.play()
File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/core/video/video_ffmpeg.py", line 47, in play
self._player = ffmpeg.FFVideo(self._filename)
AttributeError: module 'ffmpeg' has no attribute 'FFVideo'
====================== class to display images , Videos and to accept a URL as a source ==========================
class Video___(Video):
def __init__(self, **kw):
super().__init__(**kw)
def on_touch_down(self , touch) :
if self.collide_point(*touch.pos) :
print( self.source , "llllllllllllllllllllllllllll" )
#try :
if self.state == "play" :
self.state = "stop"
else :
self.state = "play"
#except:
# print("passed")
<Video___>:
keep_ratio: True
allow_stretch: True
size_hint: ( None , None)
size: [ Window.size[0] , Window.size[1] * (5/10)]