webtiming / timingsrc

Source code for timing related libraries managed by webtiming (multi-device timing CG)
GNU Lesser General Public License v3.0
157 stars 16 forks source link

Example of (LAN) Timing Provider #3

Closed lucamarogna closed 5 years ago

lucamarogna commented 6 years ago

Hi, I'd like to create a Timing Provider; I'm interested in a LAN one if it does matter.

Reading the docs here (https://webtiming.github.io/timingsrc/doc/api_timingprovider.html) I see:

Timing Providers are implemented and instansiated by third party code.

So the question is: can you share a code sample of how to realize such a Timing Provider? The language is not important, I'd like to see the overall process, general workflow, code organization, ecc.

Thank you for your support, Luca

ingararntzen commented 6 years ago

Hi Luca

We haven't got any code examples on this. The API is quite simple though.

Out of curiosity - why LAN? Are you doing offline sync-work?

Ingar

Den man. 22. okt. 2018 kl. 09:47 skrev donlucacorleone < notifications@github.com>:

Hi, I'd like to create a Timing Provider; I'm interested in a LAN one if it does matter.

Reading the docs here ( https://webtiming.github.io/timingsrc/doc/api_timingprovider.html) I see:

Timing Providers are implemented and instansiated by third party code.

So the question is: can you share a code sample of how to realize such a Timing Provider? The language is not important, I'd like to see the overall process, general workflow, code organization, ecc.

Thank you for your support, Luca

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/webtiming/timingsrc/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AFdMurJleJZkMgv4RYX6G2I0pvpnnL6Jks5unXf7gaJpZM4Xy87Q .

lucamarogna commented 5 years ago

Hi Ingar, I apologize for the late reply. I'm developing a dozen of simple kiosk-like media player for a museum. They are in the same room (and in the same LAN too) and each of them is plugged to a video projector. We would like to create an immersive experience, so sync is mandatory.

Snarkdoof commented 5 years ago

Hi Luca,

It sounds like a very nice case for multi device sync indeed! Using Motion Corporation's online sync will provide perfectly good sync for that setup, and will save you a lot of time. :-) As an added benefit, you can also synchronize the mobiles of visitors (regardless of which network they are on), for example to provide the sound, alternative information, quizzes etc on their phone, all synchronized. If you haven't tested the Motion Corp inMotion service, you can do so super quickly by checkout out https://dev.mcorp.no and make an app. Create an app, make a "global" motion, mark it as published and allow anonymous (and click "save"). Then in your web page:

var timingObj = new TIMINGSRC.TimingObject(); var app = MCorp.app("yourappid", {anon: true}); app.ready.then(function() { timingObj.timingsrc = app.motions.global; <- or whatever name you gave your motion MCorp.mediasync(mediaelem, timingObj); <- if you want to sync video or audio });

Sequencers are of course excellent if you want to synchronize images, questions for a quiz or whatever. Documentation on timingsrc web page.

Regards N

On Fri, 16 Nov 2018 at 10:54, donlucacorleone notifications@github.com wrote:

Hi Ingar, I apologize for the late reply. I'm developing a dozen of simple kiosk-like media player for a museum. They are in the same room (and in the same LAN too) and each of them is plugged to a video projector. We would like to create an immersive experience, so sync is mandatory.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/webtiming/timingsrc/issues/3#issuecomment-439341129, or mute the thread https://github.com/notifications/unsubscribe-auth/AFHzQcKXGOcljE6-3cg2hSGu6R82L_NVks5uvos_gaJpZM4Xy87Q .

lucamarogna commented 5 years ago

Already tried, of course 👍 And awesome results: really engaging and addictive, even with a 3G mobile device side by side with a ultra fast, fiber-connected, Mac Pro!

Unfortunately, the internet connection is not reliable in that room and thus we can't assume the players are sync'd with your online Timing Provider. And that's why the original question is for a "(LAN) Timing Provider" ;-)

Snarkdoof commented 5 years ago

Our solution does handle bad networks surprisingly well, have you tried it in that room? We can synchronize perfectly fine over intermittent 2G networks, although of course updates will have a longer latency. If the kiosks are playing on a loop, it will likely be perfectly fine as long as they are online once in a while. :)

N

On Fri, 16 Nov 2018 at 12:03, donlucacorleone notifications@github.com wrote:

Already tried, of course 👍 And awesome results: really engaging and addictive, even with a 3G mobile device side by side with a ultra fast, fiber-connected, Mac Pro!

Unfortunately, the internet connection is not reliable in that room and thus we can't assume the players are sync'd with your online Timing Provider. And that's why the original question is for a "(LAN) Timing Provider" ;-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/webtiming/timingsrc/issues/3#issuecomment-439359942, or mute the thread https://github.com/notifications/unsubscribe-auth/AFHzQYUMjxaqogS-OJH0E8jXPlZvqfqhks5uvpuYgaJpZM4Xy87Q .

lucamarogna commented 5 years ago

I'm working on other aspects of the kiosks at the moment. But will surely reply to you as soon as more testing were done. Thank you for your interest and participation 👍

Snarkdoof commented 5 years ago

You're welcome - and please do keep us updated on the progress, it is a very nice use case and it would be great to have it documented. :-)

N

On Fri, 16 Nov 2018 at 12:25, donlucacorleone notifications@github.com wrote:

I'm working on other aspects of the kiosks at the moment. But will surely reply to you as soon as more testing were done. Thank you for your interest and participation 👍

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/webtiming/timingsrc/issues/3#issuecomment-439364940, or mute the thread https://github.com/notifications/unsubscribe-auth/AFHzQRFyKXmK4jfRL7yCZ7ZH9IaZvB4Yks5uvqCMgaJpZM4Xy87Q .

lucamarogna commented 5 years ago

Hi guys, I'm implementing the API to use in my LAN Timing Provider because of no internet connection at all.

After 2 days of coding I'm lost in how timestamps and skew work.

I see that

The skew estimate is defined as follows. clock_timingprovider = performance.now() + skew

But how clock_timingprovider is calculated?

In a typical LAN, skew should be (close to) zero. Am I right? Well, let's assume it's 0.

Therefore the clocks (synonym of timestamps?) of the remote and client(s) are ideally equal. But performance.now() basically represents the time elapsed since the time when the window loaded in the browser. And thus two clients' performance.now() aren't the same 🤔 I think that skew is not 0...

Also on the server side - I'm using Node.JS if that matters - I use performance.now() to compute clock_timingprovider, but it starts from the execution of the Node app... I think that skew must assume some values other than 0...

Obviously I'm missing something. Can you help me?

Thanks a lot.

Snarkdoof commented 5 years ago

Hi Luca, I'm afraid we don't really have an easy fix available if you are fully offline. One thing you could do is set up a local NTP server and just use the local clock on the machines. I'd again stress that the bandwidth and stability demands of our online sync are very low, so even sharing a 2G cellphone connection should suffice, as long as all data is handled locally.

N

On Fri, 30 Nov 2018 at 17:05, donlucacorleone notifications@github.com wrote:

Hi guys, I'm implementing the API to use in my LAN Timing Provider because of no internet connection at all.

After 2 days of coding I'm lost in how timestamps and skew work.

I see that

The skew estimate is defined as follows. clock_timingprovider = performance.now() + skew

But how clock_timingprovider is calculated?

In a typical LAN, skew should be (close to) zero. Am I right? Well, let's assume it's 0.

Therefore the clocks (synonym of timestamps?) of the remote and client(s) are ideally equal. But performance.now() basically represents the time elapsed since the time when the window loaded in the browser. And thus two clients' performance.now() aren't the same 🤔 I think that skew is not 0...

Also on the server side - I'm using Node.JS if that matters - I use performance.now() to compute clock_timingprovider, but it starts from the execution of the Node app... I think that skew must assume some values other than 0...

Obviously I'm missing something. Can you help me?

Thanks a lot.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/webtiming/timingsrc/issues/3#issuecomment-443251450, or mute the thread https://github.com/notifications/unsubscribe-auth/AFHzQRI1VhU23DpSo7_Qn1Yq2VRgFQ3kks5u0VdZgaJpZM4Xy87Q .