@mrksbnc/livekit-vue 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/components.cjs +2 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.mjs +213 -0
- package/dist/components.mjs.map +1 -0
- package/dist/composables.cjs +2 -0
- package/dist/composables.cjs.map +1 -0
- package/dist/composables.d.ts +1 -0
- package/dist/composables.mjs +913 -0
- package/dist/composables.mjs.map +1 -0
- package/dist/contexts-BGR-EyiF.mjs +227 -0
- package/dist/contexts-BGR-EyiF.mjs.map +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +74 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared-B72lPzrj.cjs +2 -0
- package/dist/shared-B72lPzrj.cjs.map +1 -0
- package/dist/shared-Bt-fJtlk.cjs +2 -0
- package/dist/shared-Bt-fJtlk.cjs.map +1 -0
- package/dist/shared-UqxyWhFA.cjs +2 -0
- package/dist/shared-UqxyWhFA.cjs.map +1 -0
- package/package.json +78 -0
- package/src/App.vue +16 -0
- package/src/assets/icons/chevron-down.svg +4 -0
- package/src/assets/icons/chevron-up.svg +4 -0
- package/src/assets/icons/frown.svg +7 -0
- package/src/assets/icons/heart.svg +6 -0
- package/src/assets/icons/mic-off.svg +8 -0
- package/src/assets/icons/mic.svg +7 -0
- package/src/assets/icons/phone-hang-up.svg +9 -0
- package/src/assets/icons/share-screen-off.svg +6 -0
- package/src/assets/icons/share-screen.svg +7 -0
- package/src/assets/icons/smile.svg +7 -0
- package/src/assets/icons/thumbs-down.svg +6 -0
- package/src/assets/icons/thumbs-up.svg +6 -0
- package/src/assets/icons/video-off.svg +5 -0
- package/src/assets/icons/video.svg +5 -0
- package/src/assets/index.ts +1 -0
- package/src/assets/placeholders/participant.svg +8 -0
- package/src/components/controls/TrackToggle.vue +27 -0
- package/src/components/controls/buttons.ts +5 -0
- package/src/components/controls/index.ts +3 -0
- package/src/components/controls/track_toggle.ts +13 -0
- package/src/components/icons/ParticipantPlaceholderIcon.vue +7 -0
- package/src/components/icons/TrackIcon.vue +55 -0
- package/src/components/index.ts +3 -0
- package/src/components/participant/AudioTrack.vue +17 -0
- package/src/components/participant/audio_track.ts +8 -0
- package/src/composables/index.ts +89 -0
- package/src/composables/private/useObservableState.ts +44 -0
- package/src/composables/useAudioPlayback.ts +42 -0
- package/src/composables/useClearPinButton.ts +41 -0
- package/src/composables/useConnectionQualityIndicator.ts +39 -0
- package/src/composables/useConnectionState.ts +21 -0
- package/src/composables/useDataChannel.ts +56 -0
- package/src/composables/useDisconnectButton.ts +28 -0
- package/src/composables/useFacingMode.ts +28 -0
- package/src/composables/useFocusToggle.ts +38 -0
- package/src/composables/useGridLayout.ts +44 -0
- package/src/composables/useIsEncrypted.ts +34 -0
- package/src/composables/useIsMuted.ts +56 -0
- package/src/composables/useIsRecording.ts +30 -0
- package/src/composables/useIsSpeaking.ts +23 -0
- package/src/composables/useLiveKitRoom.ts +219 -0
- package/src/composables/useLocalParticipant.ts +64 -0
- package/src/composables/useParticipantTile.ts +68 -0
- package/src/composables/useParticipantTracks.ts +36 -0
- package/src/composables/useParticipants.ts +25 -0
- package/src/composables/usePersistentUserChoices.ts +64 -0
- package/src/composables/usePinnedTracks.ts +16 -0
- package/src/composables/useRemoteParticipant.ts +42 -0
- package/src/composables/useRemoteParticipants.ts +27 -0
- package/src/composables/useRoomInfo.ts +42 -0
- package/src/composables/useSortedParticipants.ts +21 -0
- package/src/composables/useSpeakingParticipants.ts +22 -0
- package/src/composables/useStartAudio.ts +53 -0
- package/src/composables/useStartVideo.ts +53 -0
- package/src/composables/useToken.ts +40 -0
- package/src/composables/useTrack.ts +11 -0
- package/src/composables/useTrackByName.ts +11 -0
- package/src/composables/useTrackMutedIndicator.ts +34 -0
- package/src/composables/useTrackRefBySourceOrName.ts +39 -0
- package/src/composables/useTrackSyncTime.ts +32 -0
- package/src/composables/useTrackToggle.ts +113 -0
- package/src/composables/useTrackVolume.ts +268 -0
- package/src/composables/useTracks.ts +122 -0
- package/src/composables/useVisualStableUpdate.ts +57 -0
- package/src/context/index.ts +6 -0
- package/src/context/layout.context.ts +46 -0
- package/src/context/participant.context.ts +33 -0
- package/src/context/pin.context.ts +50 -0
- package/src/context/room.context.ts +31 -0
- package/src/context/track_reference.context.ts +29 -0
- package/src/context/widget.context.ts +17 -0
- package/src/index.css +1 -0
- package/src/index.ts +5 -0
- package/src/main.ts +6 -0
- package/src/types/livekit_room.types.ts +78 -0
- package/src/utils/room.utils.ts +9 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),u=require("./shared-B72lPzrj.cjs");require("@livekit/components-core");require("rxjs");const c=require("livekit-client"),d={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",class:"mic-off",viewBox:"0 0 24 24"};function h(n,o){return e.openBlock(),e.createElementBlock("svg",d,o[0]||(o[0]=[e.createElementVNode("path",{d:"m1 1 22 22M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"},null,-1),e.createElementVNode("path",{d:"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23M12 19v4M8 23h8"},null,-1)]))}const p={render:h},m={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",class:"mic",viewBox:"0 0 24 24"};function k(n,o){return e.openBlock(),e.createElementBlock("svg",m,o[0]||(o[0]=[e.createElementVNode("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3"},null,-1),e.createElementVNode("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2M12 19v4M8 23h8"},null,-1)]))}const v={render:k},f={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",class:"share-screen-off",viewBox:"0 0 24 24"};function w(n,o){return e.openBlock(),e.createElementBlock("svg",f,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"m9.4 15.654 2.6-2.6 2.6 2.6 1.054-1.054-2.6-2.6 2.6-2.6L14.6 8.346l-2.6 2.6-2.6-2.6L8.346 9.4l2.6 2.6-2.6 2.6zM4.308 19.5q-.758 0-1.283-.525a1.75 1.75 0 0 1-.525-1.283V6.308q0-.758.525-1.283T4.308 4.5h15.384q.758 0 1.283.525t.525 1.283v11.384q0 .758-.525 1.283t-1.283.525zm0-1.5h15.384a.3.3 0 0 0 .212-.096.3.3 0 0 0 .096-.212V6.308a.3.3 0 0 0-.096-.212.3.3 0 0 0-.212-.096H4.308a.3.3 0 0 0-.212.096.3.3 0 0 0-.096.212v11.384q0 .116.096.212a.3.3 0 0 0 .212.096"},null,-1)]))}const g={render:w},B={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",class:"share-screen",viewBox:"0 0 20 20"};function _(n,o){return e.openBlock(),e.createElementBlock("svg",B,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M9.375 13.045h1.25V9.362l1.542 1.529.89-.891L10 6.955 6.955 10l.891.878 1.53-1.529zM3.59 16.25q-.631 0-1.069-.437a1.45 1.45 0 0 1-.437-1.07V5.256q0-.63.437-1.069A1.45 1.45 0 0 1 3.59 3.75h12.82q.632 0 1.07.438.437.437.437 1.068v9.488q0 .63-.438 1.069a1.45 1.45 0 0 1-1.069.437zm0-1.25h12.82a.24.24 0 0 0 .177-.08.24.24 0 0 0 .08-.177V5.256a.24.24 0 0 0-.08-.176.25.25 0 0 0-.177-.08H3.59a.25.25 0 0 0-.176.08.25.25 0 0 0-.08.176v9.488q0 .096.08.176t.176.08"},null,-1)]))}const C={render:_},x={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",class:"video-off",viewBox:"0 0 24 24"};function V(n,o){return e.openBlock(),e.createElementBlock("svg",x,o[0]||(o[0]=[e.createElementVNode("path",{d:"M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10M1 1l22 22"},null,-1)]))}const E={render:V},M={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",class:"video",viewBox:"0 0 24 24"};function y(n,o){return e.openBlock(),e.createElementBlock("svg",M,o[0]||(o[0]=[e.createElementVNode("path",{d:"m23 7-7 5 7 5z"},null,-1),e.createElementVNode("rect",{width:"15",height:"14",x:"1",y:"5",rx:"2",ry:"2"},null,-1)]))}const $={render:y},b={key:6,class:"track-icon__none"},i=e.defineComponent({__name:"TrackIcon",props:{source:{},enabled:{type:Boolean}},setup(n){const o=n,t=e.computed(()=>{switch(o.source){case c.Track.Source.Camera:return o.enabled?"camera":"camera-disabled";case c.Track.Source.Microphone:return o.enabled?"microphone":"microphone-disabled";case c.Track.Source.ScreenShare:return o.enabled?"screen-share":"screen-share-disabled";default:return"none"}}),r=e.computed(()=>"track-icon w-4 h-4 flex items-center justify-center");return(a,l)=>t.value==="camera"?(e.openBlock(),e.createBlock(e.unref($),{key:0,class:e.normalizeClass(r.value)},null,8,["class"])):t.value==="camera-disabled"?(e.openBlock(),e.createBlock(e.unref(E),{key:1,class:e.normalizeClass(r.value)},null,8,["class"])):t.value==="microphone"?(e.openBlock(),e.createBlock(e.unref(v),{key:2,class:e.normalizeClass(r.value)},null,8,["class"])):t.value==="microphone-disabled"?(e.openBlock(),e.createBlock(e.unref(p),{key:3,class:e.normalizeClass(r.value)},null,8,["class"])):t.value==="screen-share"?(e.openBlock(),e.createBlock(e.unref(C),{key:4,class:e.normalizeClass(r.value)},null,8,["class"])):t.value==="screen-share-disabled"?(e.openBlock(),e.createBlock(e.unref(g),{key:5,class:e.normalizeClass(r.value)},null,8,["class"])):(e.openBlock(),e.createElementBlock("span",b))}}),S={key:0},q=e.defineComponent({__name:"TrackToggle",props:{source:{},showIcon:{type:Boolean},initialState:{type:Boolean},captureOptions:{},publishOptions:{},onChange:{type:Function},onDeviceError:{type:Function},customOnClickHandler:{type:Function}},setup(n){const o=n,t=u.useTrackToggle(o),{buttonProps:r,enabled:a}=e.toRefs(t),l=e.ref(!1);return e.onMounted(()=>{l.value=!0}),(s,P)=>l.value?(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:0},e.unref(r),{class:"track-toggle"}),[s.showIcon?(e.openBlock(),e.createElementBlock("span",S,[e.createVNode(i,{enabled:e.unref(a),source:s.source},null,8,["enabled","source"])])):e.createCommentVNode("",!0)],16)):e.createCommentVNode("",!0)}}),N={xmlns:"http://www.w3.org/2000/svg",width:"auto",height:"auto",fill:"none",viewBox:"0 0 320 320"};function T(n,o){return e.openBlock(),e.createElementBlock("svg",N,o[0]||(o[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M160 180c44.182 0 80-35.817 80-80s-35.818-80-80-80-80 35.817-80 80 35.817 80 80 80M97.654 194.614c5.613-2.796 12.187-2.133 17.865.527 13.506 6.325 28.581 9.859 44.48 9.859 15.9 0 30.974-3.534 44.481-9.859 5.678-2.66 12.252-3.323 17.865-.527 40.358 20.105 69.64 59.122 76.246 105.448C300.15 310.997 291.045 320 280 320H40c-11.046 0-20.15-9.003-18.591-19.938 6.605-46.326 35.888-85.342 76.245-105.448"},null,-1)]))}const z={render:T},H=e.defineComponent({__name:"ParticipantPlaceholderIcon",setup(n){return(o,t)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(z))))}});exports._sfc_main=q;exports._sfc_main$1=H;exports._sfc_main$2=i;
|
|
2
|
+
//# sourceMappingURL=shared-UqxyWhFA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-UqxyWhFA.cjs","sources":["../src/assets/icons/mic-off.svg?component","../src/assets/icons/mic.svg?component","../src/assets/icons/share-screen-off.svg?component","../src/assets/icons/share-screen.svg?component","../src/assets/icons/video-off.svg?component","../src/assets/icons/video.svg?component","../src/components/icons/TrackIcon.vue","../src/components/controls/TrackToggle.vue","../src/assets/placeholders/participant.svg?component"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"stroke-width\": \"2\",\n class: \"mic-off\",\n viewBox: \"0 0 24 24\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", { d: \"m1 1 22 22M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6\" }, null, -1),\n _createElementVNode(\"path\", { d: \"M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23M12 19v4M8 23h8\" }, null, -1)\n ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"stroke-width\": \"2\",\n class: \"mic\",\n viewBox: \"0 0 24 24\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", { d: \"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3\" }, null, -1),\n _createElementVNode(\"path\", { d: \"M19 10v2a7 7 0 0 1-14 0v-2M12 19v4M8 23h8\" }, null, -1)\n ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n class: \"share-screen-off\",\n viewBox: \"0 0 24 24\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", {\n fill: \"currentColor\",\n d: \"m9.4 15.654 2.6-2.6 2.6 2.6 1.054-1.054-2.6-2.6 2.6-2.6L14.6 8.346l-2.6 2.6-2.6-2.6L8.346 9.4l2.6 2.6-2.6 2.6zM4.308 19.5q-.758 0-1.283-.525a1.75 1.75 0 0 1-.525-1.283V6.308q0-.758.525-1.283T4.308 4.5h15.384q.758 0 1.283.525t.525 1.283v11.384q0 .758-.525 1.283t-1.283.525zm0-1.5h15.384a.3.3 0 0 0 .212-.096.3.3 0 0 0 .096-.212V6.308a.3.3 0 0 0-.096-.212.3.3 0 0 0-.212-.096H4.308a.3.3 0 0 0-.212.096.3.3 0 0 0-.096.212v11.384q0 .116.096.212a.3.3 0 0 0 .212.096\"\n }, null, -1)\n ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n class: \"share-screen\",\n viewBox: \"0 0 20 20\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", {\n fill: \"currentColor\",\n d: \"M9.375 13.045h1.25V9.362l1.542 1.529.89-.891L10 6.955 6.955 10l.891.878 1.53-1.529zM3.59 16.25q-.631 0-1.069-.437a1.45 1.45 0 0 1-.437-1.07V5.256q0-.63.437-1.069A1.45 1.45 0 0 1 3.59 3.75h12.82q.632 0 1.07.438.437.437.437 1.068v9.488q0 .63-.438 1.069a1.45 1.45 0 0 1-1.069.437zm0-1.25h12.82a.24.24 0 0 0 .177-.08.24.24 0 0 0 .08-.177V5.256a.24.24 0 0 0-.08-.176.25.25 0 0 0-.177-.08H3.59a.25.25 0 0 0-.176.08.25.25 0 0 0-.08.176v9.488q0 .096.08.176t.176.08\"\n }, null, -1)\n ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"stroke-width\": \"2\",\n class: \"video-off\",\n viewBox: \"0 0 24 24\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", { d: \"M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10M1 1l22 22\" }, null, -1)\n ])))\n}\nexport default { render: render }","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-linecap\": \"round\",\n \"stroke-linejoin\": \"round\",\n \"stroke-width\": \"2\",\n class: \"video\",\n viewBox: \"0 0 24 24\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", { d: \"m23 7-7 5 7 5z\" }, null, -1),\n _createElementVNode(\"rect\", {\n width: \"15\",\n height: \"14\",\n x: \"1\",\n y: \"5\",\n rx: \"2\",\n ry: \"2\"\n }, null, -1)\n ])))\n}\nexport default { render: render }","<template>\n <VideoSvg v-if=\"source === TrackIcon.Camera\" :class=\"trackIconClasses\" />\n <VideoOffSvg v-else-if=\"source === TrackIcon.CameraDisabled\" :class=\"trackIconClasses\" />\n <MicSvg v-else-if=\"source === TrackIcon.Microphone\" :class=\"trackIconClasses\" />\n <MicOffSvg v-else-if=\"source === TrackIcon.MicrophoneDisabled\" :class=\"trackIconClasses\" />\n <ScreenShareSvg v-else-if=\"source === TrackIcon.ScreenShare\" :class=\"trackIconClasses\" />\n <ScreenShareDisabledSvg\n v-else-if=\"source === TrackIcon.ScreenShareDisabled\"\n :class=\"trackIconClasses\"\n />\n <span v-else class=\"track-icon__none\" />\n</template>\n\n<script setup lang=\"ts\">\nimport MicOffSvg from '@/assets/icons/mic-off.svg?component';\nimport MicSvg from '@/assets/icons/mic.svg?component';\nimport ScreenShareDisabledSvg from '@/assets/icons/share-screen-off.svg?component';\nimport ScreenShareSvg from '@/assets/icons/share-screen.svg?component';\nimport VideoOffSvg from '@/assets/icons/video-off.svg?component';\nimport VideoSvg from '@/assets/icons/video.svg?component';\nimport { Track } from 'livekit-client';\nimport { computed } from 'vue';\n\nconst props = defineProps<{\n source: Track.Source;\n enabled: boolean;\n}>();\n\nenum TrackIcon {\n None = 'none',\n Camera = 'camera',\n CameraDisabled = 'camera-disabled',\n Microphone = 'microphone',\n MicrophoneDisabled = 'microphone-disabled',\n ScreenShare = 'screen-share',\n ScreenShareDisabled = 'screen-share-disabled',\n}\n\nconst source = computed<TrackIcon>(() => {\n switch (props.source) {\n case Track.Source.Camera:\n return props.enabled ? TrackIcon.Camera : TrackIcon.CameraDisabled;\n case Track.Source.Microphone:\n return props.enabled ? TrackIcon.Microphone : TrackIcon.MicrophoneDisabled;\n case Track.Source.ScreenShare:\n return props.enabled ? TrackIcon.ScreenShare : TrackIcon.ScreenShareDisabled;\n default:\n return TrackIcon.None;\n }\n});\n\nconst trackIconClasses = computed<string>(() => {\n return /*tw*/ 'track-icon w-4 h-4 flex items-center justify-center';\n});\n</script>\n","<template>\n <button v-if=\"isClient\" v-bind=\"buttonProps\" class=\"track-toggle\">\n <span v-if=\"showIcon\">\n <TrackIcon :enabled=\"enabled\" :source=\"source\" />\n </span>\n </button>\n</template>\n\n<script setup lang=\"ts\" generic=\"T extends ToggleSource\">\nimport { useTrackToggle } from '@/composables';\nimport type { ToggleSource } from '@livekit/components-core';\nimport { onMounted, ref, toRefs } from 'vue';\nimport TrackIcon from '../icons/TrackIcon.vue';\nimport type { TrackToggleProps } from './track_toggle';\n\nconst props = defineProps<TrackToggleProps<T>>();\n\nconst trackToggle = useTrackToggle<T>(props);\n\nconst { buttonProps, enabled } = toRefs(trackToggle);\n\nconst isClient = ref(false);\n\nonMounted(() => {\n isClient.value = true;\n});\n</script>\n","import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"auto\",\n height: \"auto\",\n fill: \"none\",\n viewBox: \"0 0 320 320\"\n}\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, _cache[0] || (_cache[0] = [\n _createElementVNode(\"path\", {\n fill: \"currentColor\",\n d: \"M160 180c44.182 0 80-35.817 80-80s-35.818-80-80-80-80 35.817-80 80 35.817 80 80 80M97.654 194.614c5.613-2.796 12.187-2.133 17.865.527 13.506 6.325 28.581 9.859 44.48 9.859 15.9 0 30.974-3.534 44.481-9.859 5.678-2.66 12.252-3.323 17.865-.527 40.358 20.105 69.64 59.122 76.246 105.448C300.15 310.997 291.045 320 280 320H40c-11.046 0-20.15-9.003-18.591-19.938 6.605-46.326 35.888-85.342 76.245-105.448\"\n }, null, -1)\n ])))\n}\nexport default { render: render }"],"names":["_hoisted_1","render","_ctx","_cache","_openBlock","_createElementBlock","_createElementVNode","MicOffSvg","MicSvg","ScreenShareDisabledSvg","ScreenShareSvg","VideoOffSvg","VideoSvg","props","__props","source","computed","Track","trackIconClasses","trackToggle","useTrackToggle","buttonProps","enabled","toRefs","isClient","ref","onMounted","ParticipantPlaceholder"],"mappings":"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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mrksbnc/livekit-vue",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.mjs",
|
|
9
|
+
"require": "./dist/index.cjs"
|
|
10
|
+
},
|
|
11
|
+
"./index.css": {
|
|
12
|
+
"import": "./dist/index.css",
|
|
13
|
+
"require": "./dist/index.css"
|
|
14
|
+
},
|
|
15
|
+
"./composables": {
|
|
16
|
+
"types": "./dist/composables.d.ts",
|
|
17
|
+
"import": "./dist/composables.mjs",
|
|
18
|
+
"require": "./dist/composables.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"main": "dist/index.cjs",
|
|
22
|
+
"module": "dist/index.mjs",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"src"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@livekit/components-core": "^0.12.1",
|
|
29
|
+
"@vueuse/core": "^13.0.0",
|
|
30
|
+
"@vueuse/rxjs": "^13.0.0",
|
|
31
|
+
"livekit-client": "^2.9.8",
|
|
32
|
+
"rxjs": "^7.8.2",
|
|
33
|
+
"vue": "^3.5.13"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@tailwindcss/vite": "^4.0.15",
|
|
37
|
+
"@tsconfig/node22": "^22.0.0",
|
|
38
|
+
"@types/jsdom": "^21.1.7",
|
|
39
|
+
"@types/node": "^22.13.9",
|
|
40
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
41
|
+
"@vitest/eslint-plugin": "^1.1.36",
|
|
42
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
43
|
+
"@vue/eslint-config-typescript": "^14.5.0",
|
|
44
|
+
"@vue/test-utils": "^2.4.6",
|
|
45
|
+
"@vue/tsconfig": "^0.7.0",
|
|
46
|
+
"eslint": "^9.21.0",
|
|
47
|
+
"eslint-plugin-oxlint": "^0.15.13",
|
|
48
|
+
"eslint-plugin-vue": "~10.0.0",
|
|
49
|
+
"jiti": "^2.4.2",
|
|
50
|
+
"jsdom": "^26.0.0",
|
|
51
|
+
"npm-run-all2": "^7.0.2",
|
|
52
|
+
"oxlint": "^0.15.13",
|
|
53
|
+
"prettier": "3.5.3",
|
|
54
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
55
|
+
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
56
|
+
"tailwindcss": "^4.0.15",
|
|
57
|
+
"typescript": "~5.8.0",
|
|
58
|
+
"vite": "^6.2.1",
|
|
59
|
+
"vite-plugin-dts": "^4.5.3",
|
|
60
|
+
"vite-plugin-vue-devtools": "^7.7.2",
|
|
61
|
+
"vite-svg-loader": "^5.1.0",
|
|
62
|
+
"vitest": "^3.0.8",
|
|
63
|
+
"vue-tsc": "^2.2.8"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"dev": "vite",
|
|
67
|
+
"build": "run-p type-check \"build:clean {@}\" --",
|
|
68
|
+
"build:clean": "vite build",
|
|
69
|
+
"build:prod": "vite optimize --force && vite build --mode production",
|
|
70
|
+
"preview": "vite preview",
|
|
71
|
+
"test:unit": "vitest",
|
|
72
|
+
"type-check": "vue-tsc --build",
|
|
73
|
+
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
|
|
74
|
+
"lint:eslint": "eslint . --fix",
|
|
75
|
+
"lint": "run-s lint:*",
|
|
76
|
+
"format": "prettier --write src/"
|
|
77
|
+
}
|
|
78
|
+
}
|
package/src/App.vue
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="h-screen w-screen bg-gray-100">
|
|
3
|
+
<div class="flex h-full w-full flex-col items-center justify-center">
|
|
4
|
+
<div class="text-center">LiveKit Vue</div>
|
|
5
|
+
<TrackIcon :source="Track.Source.Camera" :enabled="false" />
|
|
6
|
+
|
|
7
|
+
<ParticipantPlaceholderIcon class="h-16 w-16 rounded-full" />
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { Track } from 'livekit-client';
|
|
14
|
+
import ParticipantPlaceholderIcon from './components/icons/ParticipantPlaceholderIcon.vue';
|
|
15
|
+
import TrackIcon from './components/icons/TrackIcon.vue';
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="frown">
|
|
3
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
4
|
+
<path d="M16 16s-1.5-2-4-2-4 2-4 2"></path>
|
|
5
|
+
<line x1="9" y1="9" x2="9.01" y2="9"></line>
|
|
6
|
+
<line x1="15" y1="9" x2="15.01" y2="9"></line>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="heart">
|
|
3
|
+
<path
|
|
4
|
+
d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z">
|
|
5
|
+
</path>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mic-off">
|
|
3
|
+
<line x1="1" y1="1" x2="23" y2="23"></line>
|
|
4
|
+
<path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"></path>
|
|
5
|
+
<path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"></path>
|
|
6
|
+
<line x1="12" y1="19" x2="12" y2="23"></line>
|
|
7
|
+
<line x1="8" y1="23" x2="16" y2="23"></line>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mic">
|
|
3
|
+
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
|
|
4
|
+
<path d="M19 10v2a7 7 0 0 1-14 0v-2"></path>
|
|
5
|
+
<line x1="12" y1="19" x2="12" y2="23"></line>
|
|
6
|
+
<line x1="8" y1="23" x2="16" y2="23"></line>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg viewBox="0 0 200.000000 200.000000" width="auto" height="auto" class="phone-hang-up">
|
|
2
|
+
<g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)" fill="currentColor" stroke="none">
|
|
3
|
+
<path d="M799 1330 c-149 -11 -309 -41 -399 -77 -184 -73 -265 -173 -293 -358
|
|
4
|
+
-17 -113 5 -174 76 -213 27 -14 56 -16 171 -15 227 4 244 16 261 189 9 94 15
|
|
5
|
+
120 30 130 15 11 88 14 357 14 315 0 339 -1 356 -18 15 -15 20 -41 26 -117 11
|
|
6
|
+
-163 32 -184 193 -197 191 -15 267 6 305 82 23 46 23 109 -2 205 -35 135 -96
|
|
7
|
+
211 -222 273 -173 85 -514 125 -859 102z" />
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" width="auto" height="auto"
|
|
2
|
+
class="share-screen-off">
|
|
3
|
+
<path
|
|
4
|
+
d="M9.4 15.6538L12 13.0538L14.6 15.6538L15.6538 14.6L13.0538 12L15.6538 9.4L14.6 8.34625L12 10.9462L9.4 8.34625L8.34625 9.4L10.9462 12L8.34625 14.6L9.4 15.6538ZM4.30775 19.5C3.80258 19.5 3.375 19.325 3.025 18.975C2.675 18.625 2.5 18.1974 2.5 17.6923V6.30775C2.5 5.80258 2.675 5.375 3.025 5.025C3.375 4.675 3.80258 4.5 4.30775 4.5H19.6923C20.1974 4.5 20.625 4.675 20.975 5.025C21.325 5.375 21.5 5.80258 21.5 6.30775V17.6923C21.5 18.1974 21.325 18.625 20.975 18.975C20.625 19.325 20.1974 19.5 19.6923 19.5H4.30775ZM4.30775 18H19.6923C19.7693 18 19.8398 17.9679 19.9038 17.9038C19.9679 17.8398 20 17.7692 20 17.6923V6.30775C20 6.23075 19.9679 6.16025 19.9038 6.09625C19.8398 6.03208 19.7693 6 19.6923 6H4.30775C4.23075 6 4.16025 6.03208 4.09625 6.09625C4.03208 6.16025 4 6.23075 4 6.30775V17.6923C4 17.7692 4.03208 17.8398 4.09625 17.9038C4.16025 17.9679 4.23075 18 4.30775 18Z"
|
|
5
|
+
fill="currentColor" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" class="share-screen">
|
|
2
|
+
<g>
|
|
3
|
+
<path
|
|
4
|
+
d="M9.37516 13.0448H10.6252V9.36208L12.1668 10.891L13.0579 10L10.0002 6.95521L6.95537 10L7.84641 10.8781L9.37516 9.34937V13.0448ZM3.58995 16.25C3.16898 16.25 2.81266 16.1042 2.521 15.8125C2.22933 15.5208 2.0835 15.1645 2.0835 14.7435V5.25646C2.0835 4.83549 2.22933 4.47917 2.521 4.1875C2.81266 3.89583 3.16898 3.75 3.58995 3.75H16.4104C16.8313 3.75 17.1877 3.89583 17.4793 4.1875C17.771 4.47917 17.9168 4.83549 17.9168 5.25646V14.7435C17.9168 15.1645 17.771 15.5208 17.4793 15.8125C17.1877 16.1042 16.8313 16.25 16.4104 16.25H3.58995ZM3.58995 15H16.4104C16.4745 15 16.5333 14.9733 16.5866 14.9198C16.6401 14.8665 16.6668 14.8077 16.6668 14.7435V5.25646C16.6668 5.19229 16.6401 5.13354 16.5866 5.08021C16.5333 5.02674 16.4745 5 16.4104 5H3.58995C3.52579 5 3.46704 5.02674 3.4137 5.08021C3.36023 5.13354 3.3335 5.19229 3.3335 5.25646V14.7435C3.3335 14.8077 3.36023 14.8665 3.4137 14.9198C3.46704 14.9733 3.52579 15 3.58995 15Z"
|
|
5
|
+
fill="currentColor" />
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="smile">
|
|
3
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
4
|
+
<path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
|
|
5
|
+
<line x1="9" y1="9" x2="9.01" y2="9"></line>
|
|
6
|
+
<line x1="15" y1="9" x2="15.01" y2="9"></line>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="thumbs-down">
|
|
3
|
+
<path
|
|
4
|
+
d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17">
|
|
5
|
+
</path>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="thumbs-up">
|
|
3
|
+
<path
|
|
4
|
+
d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3">
|
|
5
|
+
</path>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="video-off">
|
|
3
|
+
<path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path>
|
|
4
|
+
<line x1="1" y1="1" x2="23" y2="23"></line>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="video">
|
|
3
|
+
<polygon points="23 7 16 12 23 17 23 7"></polygon>
|
|
4
|
+
<rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.css';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="auto" height="auto" viewBox="0 0 320 320" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M160 180C204.182 180 240 144.183 240 100C240 55.8172 204.182 20 160 20C115.817 20 79.9997 55.8172 79.9997 100C79.9997 144.183 115.817 180 160 180Z"
|
|
4
|
+
fill="currentColor" fillOpacity="0.25" />
|
|
5
|
+
<path
|
|
6
|
+
d="M97.6542 194.614C103.267 191.818 109.841 192.481 115.519 195.141C129.025 201.466 144.1 205 159.999 205C175.899 205 190.973 201.466 204.48 195.141C210.158 192.481 216.732 191.818 222.345 194.614C262.703 214.719 291.985 253.736 298.591 300.062C300.15 310.997 291.045 320 280 320H39.9997C28.954 320 19.8495 310.997 21.4087 300.062C28.014 253.736 57.2966 214.72 97.6542 194.614Z"
|
|
7
|
+
fill="currentColor" fillOpacity="0.25" />
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button v-if="isClient" v-bind="buttonProps" class="track-toggle">
|
|
3
|
+
<span v-if="showIcon">
|
|
4
|
+
<TrackIcon :enabled="enabled" :source="source" />
|
|
5
|
+
</span>
|
|
6
|
+
</button>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts" generic="T extends ToggleSource">
|
|
10
|
+
import { useTrackToggle } from '@/composables';
|
|
11
|
+
import type { ToggleSource } from '@livekit/components-core';
|
|
12
|
+
import { onMounted, ref, toRefs } from 'vue';
|
|
13
|
+
import TrackIcon from '../icons/TrackIcon.vue';
|
|
14
|
+
import type { TrackToggleProps } from './track_toggle';
|
|
15
|
+
|
|
16
|
+
const props = defineProps<TrackToggleProps<T>>();
|
|
17
|
+
|
|
18
|
+
const trackToggle = useTrackToggle<T>(props);
|
|
19
|
+
|
|
20
|
+
const { buttonProps, enabled } = toRefs(trackToggle);
|
|
21
|
+
|
|
22
|
+
const isClient = ref(false);
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
isClient.value = true;
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CaptureOptionsBySource, ToggleSource } from '@livekit/components-core';
|
|
2
|
+
import type { TrackPublishOptions } from 'livekit-client';
|
|
3
|
+
|
|
4
|
+
export interface TrackToggleProps<T extends ToggleSource> {
|
|
5
|
+
source: T;
|
|
6
|
+
showIcon?: boolean;
|
|
7
|
+
initialState?: boolean;
|
|
8
|
+
captureOptions?: CaptureOptionsBySource<T>;
|
|
9
|
+
publishOptions?: TrackPublishOptions;
|
|
10
|
+
onChange?: (enabled: boolean, isUserInitiated: boolean) => void;
|
|
11
|
+
onDeviceError?: (error: Error | unknown) => void;
|
|
12
|
+
customOnClickHandler?: (evt: MouseEvent) => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VideoSvg v-if="source === TrackIcon.Camera" :class="trackIconClasses" />
|
|
3
|
+
<VideoOffSvg v-else-if="source === TrackIcon.CameraDisabled" :class="trackIconClasses" />
|
|
4
|
+
<MicSvg v-else-if="source === TrackIcon.Microphone" :class="trackIconClasses" />
|
|
5
|
+
<MicOffSvg v-else-if="source === TrackIcon.MicrophoneDisabled" :class="trackIconClasses" />
|
|
6
|
+
<ScreenShareSvg v-else-if="source === TrackIcon.ScreenShare" :class="trackIconClasses" />
|
|
7
|
+
<ScreenShareDisabledSvg
|
|
8
|
+
v-else-if="source === TrackIcon.ScreenShareDisabled"
|
|
9
|
+
:class="trackIconClasses"
|
|
10
|
+
/>
|
|
11
|
+
<span v-else class="track-icon__none" />
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import MicOffSvg from '@/assets/icons/mic-off.svg?component';
|
|
16
|
+
import MicSvg from '@/assets/icons/mic.svg?component';
|
|
17
|
+
import ScreenShareDisabledSvg from '@/assets/icons/share-screen-off.svg?component';
|
|
18
|
+
import ScreenShareSvg from '@/assets/icons/share-screen.svg?component';
|
|
19
|
+
import VideoOffSvg from '@/assets/icons/video-off.svg?component';
|
|
20
|
+
import VideoSvg from '@/assets/icons/video.svg?component';
|
|
21
|
+
import { Track } from 'livekit-client';
|
|
22
|
+
import { computed } from 'vue';
|
|
23
|
+
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
source: Track.Source;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
}>();
|
|
28
|
+
|
|
29
|
+
enum TrackIcon {
|
|
30
|
+
None = 'none',
|
|
31
|
+
Camera = 'camera',
|
|
32
|
+
CameraDisabled = 'camera-disabled',
|
|
33
|
+
Microphone = 'microphone',
|
|
34
|
+
MicrophoneDisabled = 'microphone-disabled',
|
|
35
|
+
ScreenShare = 'screen-share',
|
|
36
|
+
ScreenShareDisabled = 'screen-share-disabled',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const source = computed<TrackIcon>(() => {
|
|
40
|
+
switch (props.source) {
|
|
41
|
+
case Track.Source.Camera:
|
|
42
|
+
return props.enabled ? TrackIcon.Camera : TrackIcon.CameraDisabled;
|
|
43
|
+
case Track.Source.Microphone:
|
|
44
|
+
return props.enabled ? TrackIcon.Microphone : TrackIcon.MicrophoneDisabled;
|
|
45
|
+
case Track.Source.ScreenShare:
|
|
46
|
+
return props.enabled ? TrackIcon.ScreenShare : TrackIcon.ScreenShareDisabled;
|
|
47
|
+
default:
|
|
48
|
+
return TrackIcon.None;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const trackIconClasses = computed<string>(() => {
|
|
53
|
+
return /*tw*/ 'track-icon w-4 h-4 flex items-center justify-center';
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<audio ref="audioElement" class="audio" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { useEnsureTrackRef } from '@/context/track_reference.context';
|
|
7
|
+
import { ref, toRefs } from 'vue';
|
|
8
|
+
import { type AudioTrackProps } from './audio_track';
|
|
9
|
+
|
|
10
|
+
const props = defineProps<AudioTrackProps>();
|
|
11
|
+
|
|
12
|
+
const { trackRef, volume, muted, onSubscriptionStatusChanged } = toRefs(props);
|
|
13
|
+
|
|
14
|
+
const trackReference = useEnsureTrackRef(trackRef.value);
|
|
15
|
+
|
|
16
|
+
const audioElement = ref<HTMLAudioElement>();
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export {
|
|
2
|
+
useAudioPlayback,
|
|
3
|
+
type AudioPlaybackObservable,
|
|
4
|
+
type UseAudioPlaybackRetunType,
|
|
5
|
+
} from './useAudioPlayback';
|
|
6
|
+
export { useClearPinButton, type UseClearButtonReturnType } from './useClearPinButton';
|
|
7
|
+
export {
|
|
8
|
+
useConnectionQualityIndicator,
|
|
9
|
+
type ConnectionQualityIndicatorOptions,
|
|
10
|
+
type ConnectionQualityIndicatorReturnType,
|
|
11
|
+
} from './useConnectionQualityIndicator';
|
|
12
|
+
export { useConnectionState } from './useConnectionState';
|
|
13
|
+
export {
|
|
14
|
+
useDataChannel,
|
|
15
|
+
type MessagePayload,
|
|
16
|
+
type UseDataChannelReturnType,
|
|
17
|
+
} from './useDataChannel';
|
|
18
|
+
export { useDisconnectButton } from './useDisconnectButton';
|
|
19
|
+
export { FacingMode, useFacingMode } from './useFacingMode';
|
|
20
|
+
export {
|
|
21
|
+
useFocusToggle,
|
|
22
|
+
type UseFocusToggleProps,
|
|
23
|
+
type UseFocusToggleReturnType,
|
|
24
|
+
} from './useFocusToggle';
|
|
25
|
+
export { useGridLayout, type UseGridLayoutReturnType } from './useGridLayout';
|
|
26
|
+
export {
|
|
27
|
+
useIsEncrypted,
|
|
28
|
+
type EncryptedObservable,
|
|
29
|
+
type UseIsEncryptedOptions,
|
|
30
|
+
} from './useIsEncrypted';
|
|
31
|
+
export { useIsMuted, type UseIsMutedOptions } from './useIsMuted';
|
|
32
|
+
export { useIsRecording, type UseIsRecordingObservable } from './useIsRecording';
|
|
33
|
+
export { useIsSpeaking, type IsSpeakingObservable } from './useIsSpeaking';
|
|
34
|
+
export { useLiveKitRoom, type UseLiveKitRoomReturn } from './useLiveKitRoom';
|
|
35
|
+
export {
|
|
36
|
+
useLocalParticipant,
|
|
37
|
+
type UseLocalParticipantOptions,
|
|
38
|
+
type UseLocalParticipantReturnType,
|
|
39
|
+
} from './useLocalParticipant';
|
|
40
|
+
export { useParticipants, type UseParticipantsOptions } from './useParticipants';
|
|
41
|
+
export { useParticipantTile, type UseParticipantTileProps } from './useParticipantTile';
|
|
42
|
+
export { useParticipantTracks } from './useParticipantTracks';
|
|
43
|
+
export {
|
|
44
|
+
usePersistentUserChoices,
|
|
45
|
+
type UsePersistentUserChoicesOptions,
|
|
46
|
+
type UsePersistentUserChoicesReturnType,
|
|
47
|
+
} from './usePersistentUserChoices';
|
|
48
|
+
export { usePinnedTracks } from './usePinnedTracks';
|
|
49
|
+
export { useRemoteParticipant, type UseRemoteParticipantOptions } from './useRemoteParticipant';
|
|
50
|
+
export { useRemoteParticipants, type UseRemoteParticipantsOptions } from './useRemoteParticipants';
|
|
51
|
+
export { useRoomInfo, type RoomInfo, type UseRoomInfoOptions } from './useRoomInfo';
|
|
52
|
+
export { useSortedParticipants } from './useSortedParticipants';
|
|
53
|
+
export { useSpeakingParticipants } from './useSpeakingParticipants';
|
|
54
|
+
export {
|
|
55
|
+
useStartAudio,
|
|
56
|
+
type UseStartAudioProps,
|
|
57
|
+
type UseStartAudioReturnType,
|
|
58
|
+
} from './useStartAudio';
|
|
59
|
+
export {
|
|
60
|
+
useStartVideo,
|
|
61
|
+
type UseStartVideoProps,
|
|
62
|
+
type UseStartVideoReturnType,
|
|
63
|
+
} from './useStartVideo';
|
|
64
|
+
export { useToken, type UseTokenOptions, type UserInfo } from './useToken';
|
|
65
|
+
export { useTrack } from './useTrack';
|
|
66
|
+
export { useTrackByName } from './useTrackByName';
|
|
67
|
+
export { useTrackMutedIndicator } from './useTrackMutedIndicator';
|
|
68
|
+
export { useTrackRefBySourceOrName } from './useTrackRefBySourceOrName';
|
|
69
|
+
export {
|
|
70
|
+
requiredPlaceholders,
|
|
71
|
+
useTracks,
|
|
72
|
+
type UseTracksHookReturnType,
|
|
73
|
+
type UseTracksOptions,
|
|
74
|
+
} from './useTracks';
|
|
75
|
+
export { useTrackSyncTime } from './useTrackSyncTime';
|
|
76
|
+
export {
|
|
77
|
+
useTrackToggle,
|
|
78
|
+
type StateObserver,
|
|
79
|
+
type UseTrackToggleProps,
|
|
80
|
+
type UseTrackToggleReturnType,
|
|
81
|
+
} from './useTrackToggle';
|
|
82
|
+
export {
|
|
83
|
+
useAudioWaveform,
|
|
84
|
+
useMultibandTrackVolume,
|
|
85
|
+
useTrackVolume,
|
|
86
|
+
type AudioWaveformOptions,
|
|
87
|
+
type MultiBandTrackVolumeOptions,
|
|
88
|
+
} from './useTrackVolume';
|
|
89
|
+
export { useVisualStableUpdate, type UseVisualStableUpdateOptions } from './useVisualStableUpdate';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useSubscription } from '@vueuse/rxjs';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { computed, shallowRef, watch, type ShallowRef } from 'vue';
|
|
4
|
+
|
|
5
|
+
export type UseObservableStateArgs<T = unknown> = {
|
|
6
|
+
observable?: Observable<T> | undefined;
|
|
7
|
+
startWith: T;
|
|
8
|
+
resetWhenObservableChanges?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function useObservableState<T>(options: UseObservableStateArgs<T>): ShallowRef<T> {
|
|
12
|
+
const state = shallowRef<T>(options.startWith);
|
|
13
|
+
|
|
14
|
+
const observable = computed<Observable<T | undefined> | undefined>(() => {
|
|
15
|
+
return options.observable;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const resetWhenObservableChanges = computed<boolean>(() => {
|
|
19
|
+
return options.resetWhenObservableChanges ?? false;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
function update() {
|
|
23
|
+
if (resetWhenObservableChanges.value) {
|
|
24
|
+
state.value = options.startWith;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (typeof window === 'undefined' || !options.observable) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (observable.value) {
|
|
32
|
+
useSubscription(
|
|
33
|
+
observable.value.subscribe((value) => {
|
|
34
|
+
state.value = value ?? options.startWith;
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
watch(observable, update);
|
|
41
|
+
watch(state, update);
|
|
42
|
+
|
|
43
|
+
return state;
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useEnsureRoomContext } from '@/context/room.context';
|
|
2
|
+
import { roomAudioPlaybackAllowedObservable } from '@livekit/components-core';
|
|
3
|
+
import type { Room } from 'livekit-client';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { computed, toRefs, type ShallowRef } from 'vue';
|
|
6
|
+
import { useObservableState } from './private/useObservableState';
|
|
7
|
+
|
|
8
|
+
export type AudioPlaybackObservable = Observable<{
|
|
9
|
+
canPlayAudio: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
export type UseAudioPlaybackRetunType = {
|
|
13
|
+
canPlayAudio: ShallowRef<boolean>;
|
|
14
|
+
startAudio: () => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function useAudioPlayback(room?: Room): UseAudioPlaybackRetunType {
|
|
18
|
+
const roomEnsured = useEnsureRoomContext(room);
|
|
19
|
+
|
|
20
|
+
async function startAudio() {
|
|
21
|
+
await roomEnsured.value.startAudio();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const observable = computed<AudioPlaybackObservable>(
|
|
25
|
+
() =>
|
|
26
|
+
roomAudioPlaybackAllowedObservable(roomEnsured.value) as unknown as AudioPlaybackObservable,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const observableState = useObservableState({
|
|
30
|
+
observable: observable.value as unknown as AudioPlaybackObservable,
|
|
31
|
+
startWith: {
|
|
32
|
+
canPlayAudio: roomEnsured.value.canPlaybackVideo,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const { canPlayAudio } = toRefs(observableState.value);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
canPlayAudio,
|
|
40
|
+
startAudio,
|
|
41
|
+
};
|
|
42
|
+
}
|