Hi! Embedding from local paths is not going to work, due to security settings in your browser, which will block them: javascript - Cannot open local file - Chrome: Not allowed to load local resource - Stack Overflow (while you can sometimes disable this, it's not something I'd recommend because it does open up vulnerabilities).
So the main options for loading files are like images and audio files are:
- Use the base64-encoded file instead of the file path: This is what Prodigy does by default for images and audio files, and it works fine for smaller files and it ensures you never lose the reference to the original file. You can also use the
before_db
callback in your recipe to remove the data from the JSON before it's stored in the DB to save space. However, once your files are getting too large, sending them back and forth via the REST API is inefficient and can cause problems. - Use a local web server: Prodigy supports this for directories of images and audio input files via the
image-server
andaudio-server
loaders, but you can also just spin up a quick local web server on a different port from a given directory (e.g. using Python'shttp.server
) and then use the localhost paths instead. - Use a URL: For instance, you can put your files in an S3 bucket or similar and load them from there. This requires one more step, but it's more organised and will work across machines.
I haven't tried this yet, but what happens when you add an "audio"
property to your choice options using a localhost path or URL? In theory, it should work, because the "options"
can have the same format as regular tasks – but thinking about it, it's possible that multiple audio players per page currently don't work because Prodigy isn't isolating them correctly. If that's the case, this is definitely something we should be able to fix!