# Importing Live Internet Video in Processing

**URL:** <https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218>\
**Category:** Libraries\
**Created:** [February 8, 2019, 3:23pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218 "2019-02-08T15:23:45Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [April 19, 2022, 10:27am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/21 "2022-04-19T10:27:34Z")

</div>

Hello @rojele ,

I am sharing my brief exploration into this:

```auto
import processing.video.*;

Movie syn;

void setup() {
  size(640,480);
  String[] pageHTML = loadStrings("http://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html");
  //printArray(pageHTML);
  
  // "VideoObject","contentUrl":"https://cdn.skylinewebcams.com/video/552.mp4","description" // Looked interesting
  
  String camURLpattern = "(.m3u8)(.*?)(')";
  String[] m = match(join(pageHTML, ""), camURLpattern);
  printArray(m);
 
  //String camURL = "https://hd-auth.skylinewebcams.com/live.m3u8?a=q4rs4qnstdd81cu80oht4l7o43"; //Example and probably expired
  String camURL = "https://hd-auth.skylinewebcams.com/live.m3u8" + m[2]; //https://hd-auth.skylinewebcams.com/live // Found in Chrome > Inspect > Network

  println(camURL);
  
  // I was curious:
  pageHTML = loadStrings(camURL);
  printArray(pageHTML);
  
  //camURL = pageHTML[5];
  
  syn = new Movie(this, camURL);
  syn.play();
}

void draw() 
  {
  if (syn.available()) 
    {
    syn.read();
    }
  image(syn, 0, 0, width, height);
  }

```

It does not play with Processing.  
The link works and is a playlist that will work if opened with VLC player.

Output:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/e/1/e106a37a8ca4079e22fa5f6c8b1e85e2040c02e1.png)

References:

- [M3U8 File (What It Is and How to Open One)](https://www.lifewire.com/m3u8-file-2621956)
- [Skyline FAQs](https://www.skylinewebcams.com/en/support/faq.html)

`:)`

---

<div class="post-metadata">

**Author:** ![rojele](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rojele/32/5898_2.png) [@rojele](https://discourse.processing.org/u/rojele)\
**Post date:** [April 19, 2022, 3:23pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/22 "2022-04-19T15:23:53Z")

</div>

H, @glv! Thanks a lot for your investigation and clues. I really appreciate them!  
I see you have changed the regex pattern for matching the new circumstances of the html page. I started learning regex since my initial post but I didn’t arrive to that point.  
I know that Processing has problems playing .m3u8 extensions. I tried yesterday to play other online working .m3u8 sources with .vlc and it worked, while Processing got stuck. I thought I had two problems to solve but now it only remains one.  
I’ve been searching for other Processing video libraries but no luck so far. I’m considering to move this project to OF, but it would be a pitty since I have a considerable part already developed.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [April 21, 2022, 8:29am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/23 "2022-04-21T08:29:35Z")

</div>

Try this version of @glv code. Unfortunately, as mentioned earlier, Processing Video filters out `https`. And the trick of using `http` in my earlier example doesn’t work now. OTOH, we can use a fake URL and then set the real one directly. Works here anyway on Ubuntu 20.04 -

```auto
void setup() {
  size(640,480);
  String[] pageHTML = loadStrings("http://www.skylinewebcams.com/en/webcam/ellada/atiki/athina/ermou-street-syntagma-square.html");
  //printArray(pageHTML);
  
  // "VideoObject","contentUrl":"https://cdn.skylinewebcams.com/video/552.mp4","description" // Looked interesting
  
  String camURLpattern = "(.m3u8)(.*?)(')";
  String[] m = match(join(pageHTML, ""), camURLpattern);
  printArray(m);
 
  //String camURL = "https://hd-auth.skylinewebcams.com/live.m3u8?a=q4rs4qnstdd81cu80oht4l7o43"; //Example and probably expired
  String camURL = "https://hd-auth.skylinewebcams.com/live.m3u8" + m[2]; //https://hd-auth.skylinewebcams.com/live // Found in Chrome > Inspect > Network

  println(camURL);
  
  // I was curious:
  pageHTML = loadStrings(camURL);
  printArray(pageHTML);
  
  //camURL = pageHTML[5];
  
  syn = new Movie(this, "http://www.example.com");
  syn.playbin.setURI(java.net.URI.create(camURL));
  syn.play();
}

void draw() 
  {
  if (syn.available()) 
    {
    syn.read();
    }
  image(syn, 0, 0, width, height);
 

```

---

<div class="post-metadata">

**Author:** ![rojele](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rojele/32/5898_2.png) [@rojele](https://discourse.processing.org/u/rojele)\
**Post date:** [April 21, 2022, 11:09am UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/24 "2022-04-21T11:09:15Z")

</div>

Hi, @neilcsmith! Thanks a lot for making it work again in Ubuntu.  
Using GStreamer playbin.setfunction(URI) it’s a great workaround.

I forgot to mention the point that I’m working in windows and unfortunately it’s not playing there, since it seems there’s still a problem with the secure connection.

```auto
BaseSrc: [source] : Secure connection setup failed.
BaseSrc: [source] : Internal data stream error.
Element: [typefindelement0] : Stream doesn't contain enough data.

```

I tried changing camURL to “http//…” and I got

```auto
URIDecodeBin: [uridecodebin0] : Your GStreamer installation is missing a plug-in.
Element: [queue2-0] : Internal data stream error.

```

I got it work in ubuntu using the last version of video library (Release 8 2.0) but I would prefer to make it run on windows, if i have the chance. Any idea about this “Secure connection setup failed.”?  
A lot of thanks for the efforts inverted.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [April 21, 2022, 2:24pm UTC](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218/25 "2022-04-21T14:24:15Z")

</div>

Probably because the bundled libraries for Windows are missing something. They’re far from a complete GStreamer install. If you can find a way for the Video library to use a system installed Windows GStreamer you might be OK, but I’m not sure that’s possible without changing the code a little. It’s a total mistake IMO that the Video library ships with GStreamer bundled rather than downloading the installer.

The `http` link doesn’t work any more because it seems to be providing text (presumably an error message, but didn’t check).

[Previous page](https://discourse.processing.org/t/importing-live-internet-video-in-processing/8218.md?page=1)
