diff --git a/bg-img1.jpg b/bg-img1.jpg new file mode 100644 index 0000000..aa09a3f Binary files /dev/null and b/bg-img1.jpg differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..3deff3a --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + Video Processor + + + + + +
+ +
+ + + +
+
+ + + diff --git a/livekit-script.ts b/livekit-script.ts new file mode 100644 index 0000000..844ca53 --- /dev/null +++ b/livekit-script.ts @@ -0,0 +1,37 @@ +import { createLocalVideoTrack } from 'livekit-client'; +import { BackgroundBlur, VirtualBackground } from '../src'; +import { HighlightPersonProcessor } from '../src/HighlightPersonProcessor'; + +let videoTrack: any = null; + +const initLivekit = async () => { + videoTrack = await createLocalVideoTrack(); + const videoElm: any = document.getElementById('localVideo'); + videoTrack.attach(videoElm); +} + +const actions = { + enableBlur: async () => { + const blur = BackgroundBlur(50); + await videoTrack.setProcessor(blur); + }, + changeBg: async () => { + const bg = VirtualBackground('./bg-img1.jpg'); + await videoTrack.setProcessor(bg); + }, + enableAI: async () => { + const green = HighlightPersonProcessor({}); + await videoTrack.setProcessor(green); + } +} + +initLivekit(); + +declare global { + interface Window { + currentRoom: any; + appAction: typeof actions; + } + } + + window.appAction = actions; \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..d488826 --- /dev/null +++ b/styles.css @@ -0,0 +1,6 @@ +#localVideo { + width: 720px; + transform: rotateY(180deg); + -webkit-transform:rotateY(180deg); /* Safari and Chrome */ + -moz-transform:rotateY(180deg); /* Firefox */ +} \ No newline at end of file diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..aec6108 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,14 @@ +// vite.config.js +import { resolve } from 'path' +import { defineConfig } from 'vite' + +export default defineConfig({ + root: '.', + build: { + rollupOptions: { + input: { + main: resolve(__dirname, 'index.html'), + } + } + } +}) \ No newline at end of file