android videos/pics issues

146 views
Skip to first unread message

purushottam yadav

unread,
Apr 21, 2022, 1:16:50 PM4/21/22
to Kivy users support
Two issues I am facing  .

1) I need a widget to display both images  and videos from link over internet  

I am using below widget but display is slow and default images are appearing in between the video play .
I dont know if it is because of my slow  internet connection or something else .

suggest me something  .



from kivy.uix.image import AsyncImage

class Video__(Video , AsyncImage ):

    def __init__(self, **kw):
        super().__init__(**kw)

 .


2)
what is below error ,  how to solve it ?





04-21 22:15:50.827  7188  7438 I python  : [ERROR  ] [Loader      ] Failed to load image <https://mediauploads3.s3.amazonaws.com/f78e21d0-b8d4-4c48-9cd7-c1f9d8294cb5__1.mp4>
04-21 22:15:50.827  7188  7438 I python  : Traceback (most recent call last):
04-21 22:15:50.827  7188  7438 I python  :   File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/myappp/armeabi-v7a/kivy/loader.py", line 376, in _load_urllib
04-21 22:15:50.827  7188  7438 I python  :   File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/myappp/armeabi-v7a/kivy/loader.py", line 304, in _load_local
04-21 22:15:50.827  7188  7438 I python  :   File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/myappp/armeabi-v7a/kivy/core/image/__init__.py", line 463, in load
04-21 22:15:50.827  7188  7438 I python  : Exception: Unknown <mp4> type, no loader found.

Robert

unread,
Apr 21, 2022, 5:41:38 PM4/21/22
to Kivy users support
> 2)
> what is below error ,  how to solve it ?

Is ffpyplayer in requirements?

purushottam yadav

unread,
Apr 21, 2022, 9:29:36 PM4/21/22
to Kivy users support
yes


# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy==2.0.0,ffpyplayer,libshine,libx264,ffpyplayer_codecs , kivymd , sdl2_ttf==2.0.15 ,thumb_gen ,   plyer ,  pyzbar, libzbar,  pillow, pyjnius  , kivmob ,kivy_garden.mapview , requests  , ffmpy ,  urllib3 , chardet , idna , infomedia ,  boto3 , botocore , dateutil , jmespath , simplejson  , certifi

purushottam yadav

unread,
Apr 23, 2022, 3:39:39 AM4/23/22
to Kivy users support
do you say ffpyplayer is causing issue  ? 

and 


1) I need a widget to display both images  and videos from link over internet  

I am using below widget but display is slow and default images are appearing in between the video play .
I dont know if it is because of my slow  internet connection or something else .

suggest me something  .



from kivy.uix.image import AsyncImage

class Video__(Video , AsyncImage ):

    def __init__(self, **kw):
        super().__init__(**kw)

 .

Elliot Garbus

unread,
Apr 23, 2022, 10:05:03 AM4/23/22
to kivy-...@googlegroups.com

The Video class is derived from Image, will display images and will accept a URL as a source.  Just use the Video class.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/b2e8c01b-0656-4b95-bf73-323d315a562en%40googlegroups.com.

 

purushottam yadav

unread,
Sep 7, 2022, 3:29:17 AM9/7/22
to Kivy users support
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)]

Elliot Garbus

unread,
Sep 7, 2022, 2:40:45 PM9/7/22
to kivy-...@googlegroups.com

Do you have the appropriate video player installed?

 

This works on Windows with Gstreamer installed.

Use:  python -m pip install "kivy[full]"

 

 

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.video import Video


kv =
"""
AnchorLayout:
    TouchVideo:
        size_hint: None, None
        size: 400, 200
        source: 'http://clips.vorwaerts-gmbh.de/VfE_html5.mp4'
"""


class TouchVideo(Video):
   
def on_touch_down(self, touch):
       
if self.collide_point(*touch.pos):
           
self.state = 'play' if self.state == 'stop' else 'stop'
           
return True
        return False


class
EvalTouchVideoApp(App):
   
def build(self):
       
return Builder.load_string(kv)


EvalTouchVideoApp().run()

Robert

unread,
Sep 7, 2022, 5:58:24 PM9/7/22
to Kivy users support
I don't think I want to get involved in this one, too many moving parts!

But:

1)  " [ERROR  ] [Image       ] Error loading "  I think these messages are noise. There is an issue somewhere, but it doesn't matter.

2)  I suggest looking at the Android log in the startup phase, where it logs what drivers are loaded (just like Kivy on PC but different drivers). I don't know well enough what things should be, but I wonder about video_ffmpeg.

3) I looked to see if I have any Android examples, just one and it uses the VideoPlayer widget and has videos pushed to it. So not what you want. Its here if you want to look https://github.com/Android-for-Python/share_receive_example/blob/main/main.py

4) There is some issue with Kivy's Async* classes on Android. I don't know enough to explain or know if it is significant. I always use requests and a thread to download stuff and that is reliable.

Robert

unread,
Sep 9, 2022, 3:42:40 PM9/9/22
to Kivy users support
This may be at least part of the issue    https://github.com/kivy/kivy/pull/7994
Hopefully some dev will merge the PR
Reply all
Reply to author
Forward
0 new messages