FLECT-DEV-TEAM / FLECT-DEV-TEAM/LocalVideoEffector
Fetch API cannot load webpack:///./src/index.ts?. URL scheme must be "http" or "https" for CORS request.
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
i am try to use this package with create-react-app and getting these errors
Fetch API cannot load webpack:///./src/index.ts?. URL scheme must be "http" or "https" for CORS request.
Uncaught (in promise) DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
at CanvasRenderingContext2D.drawImage ()
at eval (webpack:///./src/index.ts?:408:56)
using this code
`
import * as React from 'react';
import { LocalVideoEffectors } from 'local-video-effector'
/**
* Main Component
*/
class App extends React.Component {
localCanvasRef = React.createRef()
localVideoEffectors = new LocalVideoEffectors(null)
componentDidMount() {
this.localVideoEffectors.cameraEnabled = true
this.localVideoEffectors.virtualBackgroundEnabled = true
this.localVideoEffectors.virtualBackgroundImagePath = '../../assets/images/vbg/pic1.jpg'; // "src\assets\images\vbg\pic1.jpg"
this.localVideoEffectors.selectInputVideoDevice("").then(() => {
requestAnimationFrame(() => this.drawVideoCanvas())
})
}
drawVideoCanvas = () => {
this.localVideoEffectors.doEffect(960,640)
if (this.localCanvasRef.current !== null) {
if (this.localVideoEffectors.outputWidth !== 0 && this.localVideoEffectors.outputHeight !== 0) {
this.localCanvasRef.current.height = (this.localCanvasRef.current.width / this.localVideoEffectors.outputWidth) * this.localVideoEffectors.outputHeight
const ctx = this.localCanvasRef.current.getContext("2d")!
ctx.drawImage(this.localVideoEffectors.outputCanvas, 0, 0, this.localCanvasRef.current.width, this.localCanvasRef.current.height)
}
}
requestAnimationFrame(() => this.drawVideoCanvas())
}
render() {
return (
)
}
}
export default App;
`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.