greeting video on time of the day

Dear friends,

I’m looking for a way to be able to show a greeting video (mp4/ovg) online when my site has a vistor depending on what the time is . So when its 09:00 hrs it would play ‘good morning’, on 14:00 hrs it would play good afternoon, etc …

Anyone an idea how to do this? Any help is much appreciated.

Best regards,
Ronnysan


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The easiest way to do this is going to be with JavaScript. For one thing, this gets around the entire problem of http://everytimezone.com where in the world they are, and what time it is there.

If these were photos (and thus much smaller than videos) I would ordinarily suggest you just stack them all in the same visual space on your page, then hide them all and show the one that you want to use based on the time. But since these are videos, I think the best way to handle this is to put a single video on the page (it can be morning, noon, or night – doesn’t matter) and then swap in the other sources based on the current time.

Something like this ought to do the trick. (Requires Prototype.js, so use the Protaculous 2 Action to add it to your page, and paste this code into the DOM Loaded Observer editor.)

If you want to use this script unmodified, the following must be true:

  1. You have three videos, and their various formats, including poster images, are named morning, afternoon, and evening. So you have morning.png, morning.m4v, and morning.ogv for the morning, for example. JavaScript is case-sensitive, so I really mean exactly morning.png, not Morning.png.

  2. You agree with my time choices: I’ve chosen 4am to 12pm as morning, 12pm to 5pm as afternoon, and 5pm to 4am as evening. (These are local times, remember.) You can adjust these by changing the numbers in the three slots. Remember, these numbers represent the beginning of the hour, but include the entire ending hour, so when you set 4,11, you are setting 4:00 - 11:59.

  3. Your video element is named ‘video’. Use the Inspector’s Name/ID field to set this from whatever Freeway applied when you imported the video.

  4. You’ve used Upload Stuff to put the other two videos (and all their fallbacks) into the Resources folder, so they are find-able by the script.

I haven’t tested this at all, except to write it in a JavaScript debugging environment, so I know that the function works without error. If you get into trouble, post a link to a public page showing the broken page. To test this at different times of day, just override the first line, like this:

var h = 20; 

That should show you the evening movie, for example. To put it back to automatic, restore it to the original code.

Walter

On May 18, 2014, at 11:49 AM, Ronny Rijksen wrote:

Dear friends,

I’m looking for a way to be able to show a greeting video (mp4/ovg) online when my site has a vistor depending on what the time is . So when its 09:00 hrs it would play ‘good morning’, on 14:00 hrs it would play good afternoon, etc …

Anyone an idea how to do this? Any help is much appreciated.

Best regards,
Ronnysan


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m sorry for the late reply!
Protaculous 2 , Dom, inspector’s Name/ID field,freeway?
Wow i see there’s much to learn for me here. I’m totaly not understanding anything of these terms. I only know to work with html and use the WYSIWYG editor but nothing about JavaScript.
Are there no other options to create something like this on a easier way?
Thanks for your quick reply anyway…
You Rock!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Believe it or not, this IS the easy way. The hard way would be to stay up all hours changing the video, and even then, it would only be correct for visitors in your time zone.

Go to ActionsForge, download Protaculous 2 (free Action) and install it by double-clicking the downloaded file, or dragging it over the Dock icon for Freeway while it is running.

Make three videos named morning.m4v, afternoon.m4v and evening.m4v. (Optionally, create poster images and alternate ogg versions, but you don’t have to do any of that to test this.) Drag morning.m4v into a new blank HTML5 page in Freeway, where it will become a new

Apply the Protaculous 2 Action to the page. Click on the DOM Loaded Observer button in the Actions palette. A window will appear where you can paste the code I posted here. Okay that dialog, and preview into a browser. You should see a hour-appropriate version of your video.

You can either wait until later in the day to see if a different video loads when you visit that page, or you can edit the JavaScript as I noted here to force the “current time” to be a different hour.

Hope this helps,

Walter

On May 20, 2014, at 8:44 AM, Ronny Rijksen wrote:

I’m sorry for the late reply!
Protaculous 2 , Dom, inspector’s Name/ID field,freeway?
Wow i see there’s much to learn for me here. I’m totaly not understanding anything of these terms. I only know to work with html and use the WYSIWYG editor but nothing about JavaScript.
Are there no other options to create something like this on a easier way?
Thanks for your quick reply anyway…
You Rock!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options