I found quite interesting a few different webcams over the internet (and particularly YouTube, but you can adapt this script to any other website). I wanted some automatic roll-over among the various camera to “broadcast” a live video of what there is outside there with almost no interaction: I want something I switch on and it takes care of itself without human interaction.
the issue is that, if you want to use YouTube, you need to interact with the website to change videos put full screen and so forth, it is not really useful if you want to have a “rolling” videos for example for your TV in your living room or in a shop window. Yes yes, YouTube has the “playlist feature” but it does not work with “live continuously streaming” channels. I needed something smarter than YouTube features.
For this reason I searched over the internet and found a few interesting scripts that allowed me to create a very simple webpage that you can put on your desktop and launch it whenever you want it.
I found a couple of nice Javascript that combined together allow me to:
- Provide a list of “preferred websites” – as many as you want
- setup a “timeout” so that the script stream each video for a certain period of time
- Use a random feature so that the next video is chose randomly among all the possibilities
- Stream full screen with no human intervention the selected video
The script is quite simple: it is a very simple HTML file you can download from here and edit it.
in order to select a video from YouTube to add to the list you just need the “embed” feature of YouTube and then select the “<iframe>” option and copy paste the selected URL form YouTube: the one that contains the word embed – the first on the left:
and the select the URL within the full text proposed by YouTube:
up to the question mark “?” excluding it and the following, since it is re-added by the script with the correct parameters.
If you want to change the timeout between the various videos you just need to change the number of milliseconds in the line:
<body onload="setTimeout(function(){window.location = 'rolling.html';},500000);
This command simply tells the script to reload itself after 500.000 milliseconds = 500 seconds = a bit more of 8 minutes.
This is a decent time to me to enjoy a video without getting too much bored of it. Of course you can change this number at your will.
to be precise, the file loads a .html file whose name is withing the parenthesis:
<body onload="setTimeout(function(){window.location = 'rolling.html';},500000);
that happens to be the same file that is calling this functions. if you change name to the file, you have to edit this name within the file itself.
Here the rolling streaming full screen from YouTube random html file :
Final touch: YouTube disturbs every now and then with advertising. this is quite annoying: you are enjoying quite wonderful landscapes or nice relaxing videos and YouTube disturbs you with annoying advertising. This is even more disturbing if you use this script for a video rollover in shop or public area. Solution is easy: just add this extension to your web browser:
this extension blocks all advertising allowing you also to enjoy many other nice features with YouTube Videos to customize your experience.
And of course you can even avoid YouTube Videos leveraging on other live streams over the internet such as Live Webcams like for example this one below or many others
In this case you need to add the URL of your video and remove the part specific to YouTube in the JavaScript, namely change this line:
var link = links[randIdx]+ "?autoplay=1&mute=1&controls=0&rel=0";
leaving the “;” at the end.