Control Hype .HTML from Smartphone .HTML


(David Guillermo Escalante Trinidad) #1

I have this control.html that will run only in Smartphones:
http://davidescalante.businesscatalyst.com/public_storage/demo_feria/control/control.html

Im looking a way, when I press each button, it will trigger a hypeDocument.showSceneNamed on the presentation .html:
http://davidescalante.businesscatalyst.com/public_storage/demo_feria/pantalla/pantalla.html

Is this possible?


#2

Yes. There is a post that explains all about accessing another document outside of another. Every document comes with a global variable that can be accessed outside of it. For example, if my document is called “test” and I exported it. I would be able to access it by using

HYPE.documents['test'].showSceneNamed('aScene');

(David Guillermo Escalante Trinidad) #3

But, does this applies if:

I run a hype html from a smartphone, and trigger a function on a desktop hype html? Both in the same local network.

Thats what im trying to achieve, when I press a button on my smartphone hype html, it should trigger a function in the desktop hype html.


#4

You will want to use the hash technique. So for example I could use a URL like

[fictitious site]
www.myhypedocument.com/presentation.html#myscene

This way the Hype document will check for a hash and then go to the scene with the value after it. In this case “myscene”.

The info is in the link above on how to implement this.

I know @MarkHunte came up with a way to go to different parts / serve the document in different languages using a .htaccess file. That could also work perhaps in this case, maybe. Not 100% sure on that one. Perhaps Mark has some info on whether that would work. If so, it could be added to the linked post?


(Mark Hunte) #5

@DBear, I think they are trying to use the smartphone page as a remote to control the page on a desktop.
Also since they talk about same network I suspect they are not talking about a server.

@Davirus maybe you can clarify further…


(David Guillermo Escalante Trinidad) #6

Yes, thats the idea. For some reason in my original post both links are the same, but here I will try to explain in better:

I want to use this hype html on a smartphone:
http://davidescalante.businesscatalyst.com/public_storage/demo_feria/control/control.html

To switch between scenes in this hype html on a desktop:
http://davidescalante.businesscatalyst.com/public_storage/demo_feria/pantalla/pantalla.html

On the desktop version you can move using the keyboard keys, but the smartphone html should be able to trigger specific scenes locations (hypeDocument.showSceneNamed)


(Mark Hunte) #7

And the network setup ?


(David Guillermo Escalante Trinidad) #8

This MAY not answer your question, but heres goes nothing:

The computer so far lacks wifi hardware, but its accesible via ethernet from any wifi device since its connected directly to the router, both devices, the smartphone and the computer are connected to the same network and each other can be accessed.

So yeah, wifi


#9

As I mentioned … the hash example is the way to go. I just mentioned Mark as he did something in the past using a .htaccess file. Couldn’t remember why you used it, Mark. Just thought it might be something here. I understand what Davirus [he] is trying to do and of course the hash technique is probably the way to go.

I’m assuming it’s a setup on the same network as he mentions local above. A .htaccess file would work but I wasn’t sure what you were doing with it before :slight_smile: i think it was serving a specific doc based on language? something like that.

Just to re-iterate @Davirususe the hash technique in the link above.

[waves his hands] “These are not the droids you’re looking for!”


(Mark Hunte) #10

If I remember yes that was what it was doing…


(Mark Hunte) #11

Have you set up any sort of server on the Desktop ?


(David Guillermo Escalante Trinidad) #12

Nodejs is what im trying to use, but so far I suck at it.

Not sure if there is a more straight forward solution or I should keep trying with nodejs.


#13

That’s probably a better way if you’re running it on the “controlled” machine. Then you can use “sockets” to converse with the server to make changes. It’s gonna be a bit of a beast.

Another possible way is to use a “synchronised” database of sorts that updates in realtime and then you’re “slave” machine can then listen for changes and based on any change it can react accordingly.

Think of it this way:

     Cloud (Firebase or something) receives message and stores it. Updates in realtime.

          /            \
         /              \

      Desktop           Phone (sends message)
(listening for change)
 updates when change made

This essentially is 2 way data binding.


(David Guillermo Escalante Trinidad) #14

Well, after some long days, I finally got it working:

https://www.facebook.com/david.escalante.77/videos/10154844029781931/

As usual, thanks for the whole Hype Team for such amazing software, everyone is pleased with the result.

We went with Node.JS for this, there is some noticeable lag, and sometimes the buttons doesn’t do anything at all, but it seems is a problem with the router, but so far, it works in with aceptable performance.


(Hans-Gerd Claßen) #15

https://www.w3schools.com/html/html5_serversentevents.asp

did not try it, but as you don’t need bidirectional functions this seems to enable easy setup …

ok, i did a short read up :slight_smile:

possible workflow:
1.) in the pointer.html create a function that writes some data (say scenename) to a file
2.) the php should read the provided info and echo -> flush()
2.) in the client.html setup the EventSource and onmessage react …

should work :slight_smile: