maxurl, video control

    May 15 2014 | 8:57 am
    Hi, Is there a way to start/stop an embedded video with maxurl ? (using the html5 tag)

    • May 16 2014 | 6:27 pm
      Hi Yoann, I don't think so. the html5 video tag can only be controlled via javascript from inside the browser.
    • May 17 2014 | 7:37 pm
      too bad....
    • May 18 2014 | 9:19 am
      Hey Yoann,
      Not knowing what you have in mind, but still I was thinking a bit along your question.
      One (not too complex) way to to control a tag from Max could be this one: It will not work for videos of on third-party portals such as Vimeo or Youtube, but you could use this way to control videos on a site that you created by yourself:
      Within the Max ToolBox you can find a Java [mxj] external that I created a while ago. It is called jm.pubNub. It's an easy way to directly push messages from Max to browsers and back directly (not going via the server that hosts the website, no need to deal with IP addresses or port forwarding ). With this you can send start/stop/pause/fullscreen (or whatever) commands to the browsers displaying that video and trigger javascript functions to control the video:
      So the connection/data flow would be:
      [Max Patch] via jm.pubNub -> push "startVideo" message to Browser -> [Browser]: triggers a (JavaScript) callback to start the video.
      You could implement this in different ways: either control all connected Browsers at the same time or chose only one/some of the connected browsers to control.
      For the latter you'll first need to generate some kind of unique ID within each web-client (connected browser) and send it back to the Max patch, so that you can identify them.
    • May 18 2014 | 7:28 pm
      Thanks, it sounds great !! What I'm trying to do is, for a performance, stream a video to the audience's devices. My 2 main problems are compatibility and synchronization. I found html5 video tag to be very good for compatibility. Now I have to see if I figure out how jm.pubNub works.... I'm not really into html and js...
    • May 18 2014 | 9:02 pm
      Hi Yoann,
      feel free to e-mail me if you have questions around that project and the pubnub thing. jan[at]janmech[dot]de. Btw, are you still in Berlin? You might not remember we once met there a few years ago. I'll be there most likely beginning/mid june.
    • Jun 01 2014 | 9:24 am
      Hi Jan,
      I'm looking at PubNub and thinking about your suggestion. Now my problem is that I need to do this* on an local network without internet connection. So it seems I can't use PubNub, am I right ?
      *Here is what I want to do: During a performance I want to trigger specific video at specific times on audience smartphones (which are connected to a local WiFi network)
      Any help would me much appreciated :)
    • Jun 01 2014 | 1:27 pm
      Hi Yoann,
      sorry for this long post, I didn't had the time to make it short ;)
      It's not a trivial task... (But I hope someone proves me wrong ;) ). You are right, pubnub requires internet access. If you want to go for the html5/ solution you need a way to "inform" the client browsers that they shall load/start a video. that's problem number one.
      problem number 2: You should be aware that even though most mobile browsers support the tag, that doesn't mean that they can all play the same video formats/encodings. The usual web solution for that is to provide several files in several formats (ie. mp4/h264, webM etc..). Well, you simply have to test that on several devices and browsers to make sure that it will work. In any case it will never be precisely in sync. you will have different delay times on each client.
      for the first problem:
      As I said, I don't see a "2-liner" solutuin, so let me give you some background information first...
      http is by it's nature a "stateless" protocol. In other words the client (browser) has to send a request to the server and only after that request the "connection" between client and server is opened. The server now can send data to the client. Once the data are transmitted, the connection is closed and the server cannot send anything to the client. It is called stateless, because the server has no information about the state of the client.
      (nowadays also web-sockets exist, which are a bidirectional connection, but i'll come to that later..)
      So by it's pure design http wouldn't allow to build something like a chat, where messages are "pushed" from the server to the client. There are two solutions/workarounds:
      - pulling - a so-called comet implementation (this is what pubnub is using).
      the comet implementation works with a trick: the client sends a request to the server, the server does NOT respond, therefor the connection stays open (for a while, if it times out a new request is send). If there are data to push to the client arriving at the server, it uses the open connection to send the data. Once they have arrived the connection is closed and the client immediately opens a new connection by sending another request. A comet implementation can be rather tricky to work reliably on different browsers - unlike you find some good javascript libraries, I don't think it'll be feasible to write that code on your own...
      pulling is much easier: clients just send a request o the server in fixed intervals (i.e. every 10 seconds) to get the new data. Well you will have a longer delay for the messages to arrive, therefore, the implementation of a pulling is really easy in javascript (on the browser). It is really a 1-liner: BUT it causes very high load on the server. so if you try this option, you need to make performance tests with the server.
      So finally the last option: web sockets.
      web sockets work much like regular network connection, just via internet protocols, hence a browser can use them. (I have no information about the support of web sockets on different mobile browsers, that would be something to research... )
      With a web socket a bidirectional connection between the client and the server is opened, and it stays open until it is closed. when the server sends data to the client a callback function triggered to do something with that data. the client part for a web socket seems to be quite straight forward. This is a jQuery plugin - though I haven't used it yet:
      On the server side it is more tricky, you will have to create a small web-app (i.e. php program) to set up the socket. Some static pages providing the player and the videos won't do the trick.
      To make a long story short:
      I think the easies solution would be to give the WiFi network you are using an internet connection and go with pubnub (even though it is a technical overkill in the backend most of the work is already done by te push service). As a second option you can try the pulling approach.
      Hope that helps at least a bit and dosen't confuse even more ... ;)
      Lastly there might be some streaming solutions, but I don't have much knowledge about that...
      Best Jan
    • Jun 03 2014 | 1:29 pm
      Thanks a lot for all these useful information !! Well....Ok, it seems more complicated than I thought.... I'll give a try with the polling option !
    • Mar 01 2016 | 3:12 pm
      We’ve developed a new HTML5 player that plays with transparency and looks exactly like the old Flash player (not with a white background - real transparency over Chrome and FireFox browsers). Here’s an example: