twilio / twilio-video-processors.js

Twilio Video Processors is a collection of video processing tools which can be used with Twilio Video JavaScript SDK to apply transformations and filters to a video track.
Other
33 stars 21 forks source link

Unable to load background if image component is set with non local image. #52

Closed JaekwanLee closed 1 year ago

JaekwanLee commented 1 year ago

Hi,

I have started integrating a video processor for setting up background image. Unlike given example in the repository, we uses images from an external url. However, if an image component is created with an external URL - we uses a public image from aws s3 -, the video becomes blank and not rendering anything.

For example, the below image component works.

<img src="/backgrounds/vacation.jpg">

However, the below image component will break the video.

<img src="http://[another domain]/backgrounds/vacation.jpg">

To test this I locally ran two http server(Port 3000 as processor example and 8080 to serve the same asset but using domain). To simply avoid img component creation, I directly put the image component and put it into backgroundImage of VirtualBackgroundProcessor.

index.html
<img src="http://localhost:8080/backgrounds/vacation.jpg" id="remoteImage">

index.js
     virtualBackgroundProcessor = new VirtualBackgroundProcessor({
       assetsPath: '',
       maskBlurRadius,
       backgroundImage: document.getElementById('remoteImage'),
       fitType,
     })

Code to reproduce the issue:

// TODO

Expected behavior:

TODO

Actual behavior:

TODO

Software versions:

manjeshbhargav commented 1 year ago

Hi @JaekwanLee ,

The documentation for VirtualBackgroundProcessorOptions.backgroundImage contains a link to the security guidelines required for loading images from a different origin. Please follow them and let me know if that works for you.

JaekwanLee commented 1 year ago

@manjeshbhargav Thanks. It worked after setting CORS on the image

Moavia-00 commented 9 months ago

@manjeshbhargav Thanks. It worked after setting CORS on the image

@JaekwanLee can you show me how you did that?