If the direct video link is http you should be able to pass it in where you’d normally pass the file in Processing Video’s Movie class. For some reason the url protocols are restricted. You could also use PraxisLIVE - the video library there doesn’t have that restriction.
I think it works as http too so you might be in luck. Use a Movie example from the Video library and pass in that link (as http not https) instead of the filename. Does it work?
The problem you’ll have is finding the link each time. It will probably change every few hours. I used a Linux CLI tool called youtube-dl to extract the link. It’s currently working in PraxisLIVE with GStreamer 1.x so should work with Video Library v2 beta if not v1.
If the page url is stable, and the form of the link is stable – but the subdomain and suffix changes all the time – then you can retrieve the url dynamically at run time using a regex. Something like this:
As long as the url follows the pattern you specify, the code will pick it up – assuming you can then load the live video directly with processing.video (untested).
Try the IPCapture library that you can install in Processing using the Contribution Manager. Unsure if it will work with your video format but worth checking: https://processing.org/reference/libraries/
@kfrajer as far as I can tell that library says it’s just for MJPEG? Which would make sense if it’s pure Java. The Video library should be able to play this, GStreamer certainly is fine, but getting the actual link is more “fun”.
@kll How did you get the link when you first posted?
i dig website with inspect ?media? …
but when i call it in browser a download started.
when i click that: vlc started and show the stream
for a few seconds. reloading the same link does not work,
must run program again to get a new “a=xxxxx”
that way can find it, BUT not show it??
again call browser, get download, click VLC works
String theURL = "https://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html";
String thestart = "https://hddn01.skylinewebcams.com/live.m3u8";
String theend = "'},";
String[] incoming;
int srcindex, srcend;
String line,picsrc;
PImage found;
boolean foundone = false;
void setup() {
size(400,400);
incoming = loadStrings(theURL);
//printArray(incoming);
for (int i=0; i<incoming.length; i++) {
srcindex=0;
srcend=0;
line = incoming[i];
srcindex = line.indexOf(thestart);
if ( srcindex > 0 )//&& srcend > 0 && srcend > srcindex)
{
picsrc = line.substring(srcindex); // use second part
srcend = picsrc.indexOf(theend); // search end in that part only
println("i "+i+" srcindex "+srcindex+" srcend "+srcend);
picsrc = picsrc.substring(0, srcend); // cut of rest
println(picsrc);
//found = loadImage(picsrc);
foundone = true;
}
}
}
void draw() {
// if ( foundone ) image(found,0,0);
}
Maybe I misunderstood. When you run my 5-line sketch above, it loads the skylinewebcams page, finds the latest .m3u8 url with the ?a= suffix, which is in the page, and prints it. This is the one you referred to when you said “The link has changed […] The problem you’ll have is finding the link each time.”
Not familiar with “blob URI” – if the m3u8 url isn’t what is needed, then apologies for the confusion.
Sorry, you’re right. I only inspected the page in the browser and found the blob URL in the video element, which is normally for hiding things. Didn’t realise the .m3u8 URL is in the script element. Lousy hiding, but it fooled me!
So putting it all together, with Video library v2 beta, replacing the gst1-java-core-0.9.1.jar file with the latest gst1-java-core-0.9.4.jar (there’s a bug), adapting to force a http URL (because https gets filtered in the Video library), and using the system installed GStreamer on Ubuntu 18.04 we can get it to work. Whether it works with any other combination remains to be seen.
Hi! I know that’s a three years old thread but I’m after this exact matter in this moment.
Using the 5 lines code by @jeremydouglass or the final example from @neilcsmith, string _m returns null (windows).
I know I will need to make the effort of learning regex, understanding what’s happening and adapt it for other live video websites, but actually I would like to know if this code you provided is already working in your system or any variation in the webpage has made it unworkable.
Thanks a lot for the efforts.
Hi! I actually found that there’s not any .m3u8 url accessible from the “inspector” tab of the browser (apart from “source:'livee.m3u8?” that doesn’t seem to be what I need in order to play it).
The only way for getting a valid .m3u8 url of a video is through the “network” tab, and I does not have the foggiest idea about how to dig there with processing loadStrings(), because it doesn’t seem to be in the DOM.
I wonder if this problem was there at the beginning of this thread or is a circumstance that was not there at that time.
Thanks a lot.