ssssam / hydra

Livecoding networked visuals in the browser [Sam Thursfield's fork]
https://hydra-editor.glitch.me/
GNU Affero General Public License v3.0
0 stars 0 forks source link

Allow injecting videos and images #3

Open ssssam opened 5 years ago

ssssam commented 5 years ago

Maybe if the server can share these over WebRTC, they can be used in the client as sources.

ssssam commented 5 years ago

Images and videos can be injected following this example: https://github.com/zachkrall/hydra-workshop/blob/master/examples/07-use-image.js

var myElement = document.createElement('img');
myElement.src = '/path/to/img.jpg';
s0.init( { src: myElement , dynamic: false   /* set true for video */  });

Security restrictions seem to prevent images from loading anywhere other than the server's public/ directory. But putting files in there is easy enough for now.

It would be nice to add a s0.initImage() and s0.initVideo() function that would create the element for you!

ssssam commented 5 years ago

Done in branch: https://github.com/ssssam/hydra-synth/tree/sam/image-and-video-helper

ssssam commented 5 years ago

Need to update the hydra-synth README.md