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.


    Playing .mp4 videos in any of the ui elements

    Pythonista
    3
    10
    5273
    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.
    • Phuket2
      Phuket2 last edited by

      Is it possible to play .mp4 files in say a custom view or any other ui element? I don't just need an external player, I want to be able to overlay ui elements on the .mp4 file I am playing. I really want full control over the screen and playback. Any suggestions appreciated

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

        Learn Swift ;-)

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

          Lol, 20,000 += 290 odd extra .... I see your humor, I think patience is not your middle name :) it's ok, I am not very patient also, however I have got better. I look fwd to meet you sometime. Sure we would have fun!

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

            My bet is that our JavaScript knowledgeable brethren know how to do it in Pythonista.

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

              Lol, I am just going to order another black soda ;) really

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

                @ccc, how do I give you my email, I have no problem just to write it here. nothing to hide. I just don't see any details of anyone here. If you like to keep it that way, it's ok. If you would like to chat on email also, I will pass on my email anyway you like

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

                  you can show video in an ui.WebView. you need to know a bit of html, in which case you would embed the video just like you would in html. if you are linking to video on the web, just use th embed code from whatever side you are using. for hosting video locally in pythonista, you would use a relative address, relative to the page source.

                  now, if you want control over playback, that is trickier. your best bet is just to do everything in JavaScript, for example see here, including the ui elements that directly interact wight the video, unless you really need to pass something back and forth to Python, which is a pain, but doable. to interact with the Python, you need to have JavaScript functions that are callable using eval_js. having done a little of this before, let me say doing JavaScript in pythonista is rather unpleasant, since debugging is very hard, and most errors happen silently.... things are probably a bit better in the beta, if only for the tabbed editor, and some html editor support

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

                    Ok, thanks @JonB. I am surprised actually. I hadn’t given it any thought. I just assumed it would be quite simple to do, even if had to,use Scene or something. So, it sounds like no type of media element we be in the new version also. Out of interest, is there a media type control that omz could make a wrapper for in iOS? Maybe the word wrapper is an over simplification of what's involved. Maybe the intended wrapper is just the webview as you suggest. I managed to get youtube videos (streaming) working fine in the webview. But because I just used the embed type, I didn't have much control over the presentation etc. I was basically limited to the URL params. It was ok to get started, but then wanted to move on to my own files.
                    As a fun distraction, I wanted to create a video display the same as the bar has that I go to each afternoon. They run virtual DJ with a bunch of plugins to show music videos, with a fly out strip with the song name, artist etc... A few transparent logo's and a ticker at the bottom. Looks very smart. Also they have some nice panels overlaying in response to SMS and email messages. Looks great, but it's no rocket science. That program does so much more, but in this case not. Anyway, I thought would be fun to make it and use AirPlay to the TV. I got the YouTube_dl that has been modified for Pythonista installed,and it works perfectly. The info JSON files are great.
                    Oh, I just had a thought. I did some very simple tests with bottle before. Meaning I assume that pythonista has a built in web server. I think. So, if I could start that web server, could I play my disk videos in the webview by using localhost addresses?

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

                      you don't need to start a server to play local files. just provide a full abspath to the initial html file. you certainly can use bottle, if you need things to be dynamically generated, but for many simple static pages it is not needed.

                      https://developers.google.com/youtube/iframe_api_reference is the JavaScript api for YouTube, which lets you queue up videos, control playback, etc. I think that is your best bet, but again it has to mostly be done in javascript.

                      actually, one problem you might encounter is that iOS has some security settings that may prevent videos from playing without the user pressing the red play button.... not sure if the embedded browser has that flag set or not.

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

                        Thanks @JonB, I guests here visiting at the moment, but will try it as soon as I can.

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