maxurl, video control
Is there a way to start/stop an embedded video with maxurl ?
(using the html5 <video> tag)
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 <video> 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:
So the connection/data flow would be:
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.
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…
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.
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 :)
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/<video> 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 <video> 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:
– a so-called comet implementation (this is what pubnub is using).
It is really a 1-liner: http://www.w3schools.com/js/js_timing.asp
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…
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 !
Forums > MaxMSP