External Sources
Hydra can use external media: images, video, a webcam and the screen. They load into the variables s0, s1, s2, s3.
initImage() — Image
Loads an image from a URL as a visual source.
s0.initImage(url)
Supported formats: .jpeg, .jpg, .png, .bmp, .gif, .webp
initVideo() — Video
Loads a video file from a URL as a source.
s0.initVideo(url)
Supported formats: .mp4, .ogg, .webm
initCam() — Webcam
Starts a video stream from the webcam.
s0.initCam(index)
| Parameter | Default | Description |
|---|---|---|
| index | 0 | Camera number (when there are several) |
initScreen() — Screen capture
Captures the screen, a window or a browser tab.
s0.initScreen()
A complete example with music
Fixing CORS problems
If an image or video does not load:
-
Use services with CORS support:
- Wikimedia Commons
- Imgur
- Giphy
-
For YouTube/Vimeo, use
initScreen()to capture the browser window