omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    [SOLVED] Embedding a webvr experience using pythonista

    Pythonista
    3
    10
    5559
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Brun0oO
      Brun0oO last edited by Brun0oO

      Hi,

      Here a demo : https://github.com/Brun0oO/Pythonista/tree/master/webvr_embedded

      My goal is to embed a webvr experience using pythonista and more specially to display a stereoscopic 360 video (it sounds crazy does it not?).

      My results :

      * If I use a webview then I manage to display an online webvr experience.
      * If I use a local flask server then I manage to stream a video to my webview.
      * But if I try to embed the webvr experience and use my local streaming server then the same video is not displayed...

      Can anyone help me ?

      Thanks a lot !

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        You might need to host all of the files locally. Download the JavaScript used by the web vr

        1 Reply Last reply Reply Quote 0
        • Brun0oO
          Brun0oO last edited by

          @JonB : thanks for your advice but I think I host all the files locally and I use theses resources correctly (have a look to the 'web/static/js' directory and the 'vr_embedded.html' file). Is there anything in particular you're referring to?

          1 Reply Last reply Reply Quote 0
          • Brun0oO
            Brun0oO last edited by

            I got it, now it works !
            I'm going to suggest some modifications of wkwebview.py to its author ;o)

            Note: I need to find a better way to clear the web cache... sometimes it fails...

            mikael 1 Reply Last reply Reply Quote 0
            • mikael
              mikael @Brun0oO last edited by

              @Brun0oO said:

              I'm going to suggest some modifications of wkwebview.py to its author ;o)

              Please do submit improvements or ideas, either here or as issues/pull requests.

              1 Reply Last reply Reply Quote 0
              • Brun0oO
                Brun0oO last edited by

                @mikael said:

                Please do submit improvements or ideas, either here or as issues/pull requests.

                Ok I made my first pull requests on your repository ;o)
                do not hesitate to tell me if this is badly done...

                I think I still have a kind of memory leak in my script since I can't run it twice (Pythonista leaves unexpectedly) but I think it's not related to your script...
                Indeed strange thing : I have to call a blank page when closing my script otherwise the sound of my video continues to play...

                mikael 1 Reply Last reply Reply Quote 0
                • mikael
                  mikael @Brun0oO last edited by

                  @Brun0oO said:

                  Ok I made my first pull requests on your repository ;o)

                  Thanks, will take a look.

                  I think I still have a kind of memory leak in my script since I can't run it twice (Pythonista leaves unexpectedly) but I think it's not related to your script...

                  What is the ObjC exception? (Search for dgelessus pythonista_startup if you have not set up ObjC exception logging earlier.)

                  1 Reply Last reply Reply Quote 0
                  • Brun0oO
                    Brun0oO last edited by Brun0oO

                    @mikael said:

                    What is the ObjC exception?

                    Thank you a lot for the dgelessus's trick !
                    Here the detail of the caught exception :

                    Fatal Python error: Bus error
                    
                    Thread 0x000000016e253000 (most recent call first):
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/selectors.py", line 377 in select
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/socketserver.py", line 237 in serve_forever
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/werkzeug/serving.py", line 437 in serve_forever
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/werkzeug/serving.py", line 693 in inner
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/werkzeug/serving.py", line 711 in run_simple
                      File "/private/var/mobile/Containers/Shared/AppGroup/A0225C98-C19E-4DB5-B0EE-E750A7DDCC8E/Pythonista3/Documents/site-packages/flask/app.py", line 841 in run
                      File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/webvr_embedded/main.py", line 152 in run
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/threading.py", line 917 in _bootstrap_inner
                      File "/var/containers/Bundle/Application/8FF92FC6-5C37-4D62-B81A-058EFF5E9BFF/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/threading.py", line 885 in _bootstrap
                    
                    Thread 0x000000016dcbb000 (most recent call first):
                      File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/webvr_embedded/main.py", line 206 in __init__
                      File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/webvr_embedded/main.py", line 258 in <module>
                    

                    As you can see, I think the problem comes from my embedded http server. I do not have to close it properly (despite my attempt)... well it's not easy because of the external library and the multi threading mechanism used...I will try to look more closely (if anyone wants to help me, I'm interested ;o)

                    mikael 1 Reply Last reply Reply Quote 0
                    • JonB
                      JonB last edited by

                      Have you tried this to close the app?

                      1 Reply Last reply Reply Quote 0
                      • mikael
                        mikael @Brun0oO last edited by

                        @Brun0oO, I have been using this bottle server to be my cleanly exiting threaded web server, for quite a while now, without issues.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors