@live-change/video-call-frontend 0.8.37

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2024 Michał Łaszczewski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,78 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <!--head-->
5
+ </head>
6
+ <body>
7
+ <!--body-tags-open-->
8
+ <div id="app"><!--app-html--></div>
9
+ <!--app-data-->
10
+ <!--body-tags-->
11
+ <script type="module" src="/src/entry-client.js"></script>
12
+
13
+ <div>
14
+ <div id="not-supported" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
15
+ z-index: 1000; background-color: black; color: white; font-size: 20px; font-family: sans-serif;
16
+ align-items: center; justify-content: center; overflow-y: auto">
17
+ <div style="padding: 2em;">
18
+ <h1 style="margin-bottom: 1.23em">Your browser is not supported.</h1>
19
+ <p>We apologize for the inconvenience, but it seems that your current web browser version does not support
20
+ our web application.</p>
21
+ <p>In order to use our service, you would need to upgrade to, or install, one of the following browsers:</p>
22
+ <ul>
23
+ <li>Microsoft Edge 99 or later</li>
24
+ <li>Mozilla Firefox 97 or later</li>
25
+ <li>Google Chrome 99 or later</li>
26
+ <li>Apple Safari 15 or later</li>
27
+ </ul>
28
+ <p>Please note that our application does not function with older browser versions. We've optimized our service
29
+ for the above-mentioned browsers to ensure robust functionality and a smooth user experience.</p>
30
+ <p>If you need assistance with updating your browser or installing a new one, please consult your browser's
31
+ help documentation or contact your IT support.</p>
32
+ <p>Thank you for your understanding and cooperation. We're eager to deliver a great experience with our
33
+ web application.</p>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <script>
38
+ const oses = ['Windows', 'Android', 'Linux', 'iPhone', 'iPad', 'iPod', 'Mac OS']
39
+ const browsers = ['Edg', 'Edge', 'CriOS', 'OPR', 'Chrome', 'SamsungBrowser', 'Firefox', 'Opera', 'Safari']
40
+ const ua = window.navigator.userAgent
41
+ const detected = {}
42
+ for(const browser of browsers) {
43
+ const match = ua.match(new RegExp(`(${browser})/([^ ;)]*)`,'i'))
44
+ if(match) {
45
+ detected.browser = match[1]
46
+ detected.browserVersion = match[2]
47
+ break
48
+ }
49
+ }
50
+ const match = ua.match(new RegExp(`Version/([^ ;)]*)`,'i'))
51
+ if(match) detected.browser = match[1]
52
+ for(const os of oses) {
53
+ const match = ua.match(new RegExp(`(${os}) ?([^;)]*)`,'i'))
54
+ if(match) {
55
+ detected.os = match[1]
56
+ detected.osVersion = match[2]
57
+ break
58
+ }
59
+ }
60
+
61
+ if(!(typeof CSSLayerBlockRule === 'function')) {
62
+ document.getElementById('not-supported').style.display = 'flex'
63
+ console.error("CSS Layers not supported!")
64
+ }
65
+
66
+ detected.browserVersionMajor = +detected.browserVersion.split('.')[0]
67
+ document.body.classList.add('on-browser-' + detected.browser.toLowerCase())
68
+ document.body.classList.add('on-os-' + detected.os.replace(' ','-').toLowerCase())
69
+ window.onload = function() { setTimeout(function() {
70
+ if(!window.appStarted) {
71
+ document.getElementById('not-supported').style.display = 'flex'
72
+ console.error("App not started!")
73
+ }
74
+ }, 1000) }
75
+ </script>
76
+
77
+ </body>
78
+ </html>
@@ -0,0 +1,26 @@
1
+ import messages from "./en.json"
2
+ export { messages }
3
+
4
+ export const numberFormats ={
5
+ "usd": {
6
+ "style": "currency",
7
+ "currency": "USD",
8
+ "notation": "standard"
9
+ }
10
+ }
11
+
12
+ export const datetimeFormats = {
13
+ "short": {
14
+ "year": "numeric", "month": "short", "day": "numeric"
15
+ },
16
+ "shortTime": {
17
+ "dateStyle": "short", "timeStyle": "short", "hour12": false
18
+ },
19
+ "shortestTime": {
20
+ "month": "numeric", "day": "numeric", "hour": "numeric", "minute": "numeric", "hour12": false
21
+ },
22
+ "long": {
23
+ "year": "numeric", "month": "short", "day": "numeric",
24
+ "weekday": "short", "hour": "numeric", "minute": "numeric"
25
+ }
26
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "app": {
3
+ "updateAvailable": "Update available!",
4
+ "newVersions": "New version of app is available!",
5
+ "reload": "Reload"
6
+ }
7
+ }
Binary file
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+
4
+ <svg
5
+ version="1.1"
6
+ id="Layer_1"
7
+ x="0px"
8
+ y="0px"
9
+ width="512px"
10
+ height="512px"
11
+ viewBox="0 0 512 512"
12
+ enable-background="new 0 0 512 512"
13
+ xml:space="preserve"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ xmlns:svg="http://www.w3.org/2000/svg"
16
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ xmlns:cc="http://creativecommons.org/ns#"
18
+ xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
19
+ id="metadata9"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs7" />
23
+ <rect
24
+ style="fill:#dbdbdb;fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
25
+ id="rect821"
26
+ width="512.54236"
27
+ height="512.54236"
28
+ x="0.54237288"
29
+ y="0.54237235" />
30
+ <path
31
+ style="fill:#f6f6f6;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
32
+ d="M 0.54237288,470.23729 125.83051,306.44068 l 60.20339,70.50847 130.71186,-174.10169 195.79661,261.42373 0.54235,48.81353 H 0.54237288 Z"
33
+ id="path816" /><circle
34
+ style="fill:#f6f6f6;fill-opacity:1;stroke:none;stroke-width:4.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
35
+ id="path818"
36
+ cx="118.50848"
37
+ cy="106.57627"
38
+ r="57.762711" /></svg>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+
4
+ <svg
5
+ version="1.1"
6
+ id="Layer_1"
7
+ x="0px"
8
+ y="0px"
9
+ width="512px"
10
+ height="512px"
11
+ viewBox="0 0 512 512"
12
+ enable-background="new 0 0 512 512"
13
+ xml:space="preserve"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ xmlns:svg="http://www.w3.org/2000/svg"
16
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ xmlns:cc="http://creativecommons.org/ns#"
18
+ xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
19
+ id="metadata9"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs7" />
23
+ <rect
24
+ style="fill:#dbdbdb;fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
25
+ id="rect821"
26
+ width="512.54236"
27
+ height="512.54236"
28
+ x="0.54237288"
29
+ y="0.54237235" /><path
30
+ d="m 313.14122,310.64877 c 9.02181,-8.85097 12.15686,-31.23733 20.41627,-39.3056 11.69771,-11.43183 24.39381,-25.50218 27.98588,-43.06851 4.82003,-23.34203 -4.96846,-26.30516 -4.96846,-34.3713 0,-16.90002 -0.15376,-44.65739 -5.43081,-62.68607 -0.30326,-23.7809 -4.20499,-34.123578 -12.38858,-43.031138 -7.72017,-8.33522 -26.68637,-6.366203 -36.59125,-11.85361 C 286.83605,67.825407 274.23818,64.594254 258.15823,64.17461 v -0.09503 c -0.47624,0 -0.93539,0.05659 -1.41162,0.05659 -0.78484,0 -1.53123,-0.05659 -2.35343,-0.05659 l 0.0395,0.151627 c -39.17105,1.472492 -80.84608,26.170627 -95.16524,65.895863 -5.31335,14.71958 -3.28881,46.87521 -3.28881,63.77522 0,8.06721 -9.78742,11.02927 -4.96846,34.37131 3.61129,17.56632 16.28817,31.63668 27.98588,43.06851 8.26048,8.06827 11.39446,30.45462 20.39705,39.30559 1.96902,13.0378 2.1986,9.31012 2.12278,21.23954 -0.0203,4.03307 0.11426,10.28502 -6.32669,16.4398 -12.17822,11.6614 -40.14595,36.95324 -63.08756,46.79832 -30.24,12.98014 -79.41203,33.74237 -90.746691,39.59069 -11.334661,5.84833 -41.2532541,21.69763 -41.2532541,31.79045 0,10.11417 0,47.33542 0,47.33542 h 253.3742451 5.79494 253.37318 c 0,0 0,-37.22125 0,-47.33542 0,-10.09282 -29.89723,-25.94212 -41.25645,-31.79045 -11.35389,-5.84938 -60.48321,-26.61055 -90.72641,-39.59069 -22.32976,-9.57707 -49.43685,-33.81712 -62.09344,-45.84158 -4.2808,-4.05228 -7.3016,-8.29784 -7.3411,-18.62023 -0.0737,-12.00417 0.23278,-7.41692 2.14306,-20.01478"
31
+ id="path2"
32
+ style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:1.06779659;fill:#f6f6f6;fill-opacity:1" />
33
+ </svg>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ width="512"
4
+ height="512"
5
+ viewBox="0 0 135.46667 135.46667"
6
+ version="1.1"
7
+ id="svg977"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:svg="http://www.w3.org/2000/svg"
10
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
11
+ xmlns:cc="http://creativecommons.org/ns#"
12
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
13
+ <defs
14
+ id="defs971" />
15
+ <metadata
16
+ id="metadata974">
17
+ <rdf:RDF>
18
+ <cc:Work
19
+ rdf:about="">
20
+ <dc:format>image/svg+xml</dc:format>
21
+ <dc:type
22
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
23
+ </cc:Work>
24
+ </rdf:RDF>
25
+ </metadata>
26
+ <g
27
+ id="layer1"
28
+ style="fill:#666666">
29
+ <path
30
+ style="fill:#666666;fill-opacity:1;stroke:none;stroke-width:2.70907px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
31
+ d="M 54.181439,13.558436 67.726801,0.01304296 135.45359,67.739804 67.726801,135.46667 29.799793,97.539626 V 65.030766 L 13.545362,81.285197 0,67.739804 40.636077,27.103727 81.272154,67.739804 67.726801,81.285197 51.472371,65.030766 V 92.12155 l 16.25443,16.25433 40.636069,-40.636076 z"
32
+ id="path892" />
33
+ </g>
34
+ </svg>
Binary file
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <view-root>
3
+ <template #navbar>
4
+ <NavBar />
5
+ <UpdateBanner />
6
+ </template>
7
+ </view-root>
8
+ </template>
9
+
10
+ <script setup>
11
+ import 'primevue/resources/themes/saga-green/theme.css'
12
+ import "@fortawesome/fontawesome-free/css/all.min.css"
13
+
14
+ import { useLocale } from '@live-change/vue3-components'
15
+ const locale = useLocale()
16
+ locale.captureLocale()
17
+
18
+ import { ViewRoot, NavBar, UpdateBanner } from "@live-change/frontend-base"
19
+
20
+ import { computed } from 'vue'
21
+ import { useHead } from '@vueuse/head'
22
+
23
+ import { useI18n } from 'vue-i18n'
24
+ const i18n = useI18n()
25
+
26
+ useHead(computed(() => ({
27
+ title: ENV_BRAND_NAME,
28
+ meta: [
29
+ { charset: 'utf-8' },
30
+ { name: 'viewport',
31
+ content: "user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1," +
32
+ " width=device-width, viewport-fit=cover" }
33
+ ],
34
+ htmlAttrs: {
35
+ lang: i18n.locale.value,
36
+ amp: true
37
+ },
38
+ })))
39
+
40
+ import { watch } from 'vue'
41
+ import { client as useClient, useApi } from '@live-change/vue3-ssr'
42
+ const client = useClient()
43
+ watch(client, (newClient, oldClient) => {
44
+ console.log("WATCH CLIENT", oldClient, '=>', newClient)
45
+ })
46
+
47
+ const api = useApi()
48
+ import emailValidator from "@live-change/email-service/clientEmailValidator.js"
49
+ import passwordValidator from "@live-change/password-authentication-service/clientPasswordValidator.js"
50
+ api.validators.email = emailValidator
51
+ api.validators.password = passwordValidator
52
+
53
+ import { defaultHighlightStyle } from "@codemirror/language"
54
+ import { StyleModule } from "style-mod"
55
+ if(typeof window != 'undefined') {
56
+ StyleModule.mount(window.document, defaultHighlightStyle.module)
57
+ }
58
+
59
+ </script>
@@ -0,0 +1,26 @@
1
+ import deepmerge from 'deepmerge';
2
+
3
+ import * as en from "../locales/en.js"
4
+ import { locales as autoFormLocales } from "@live-change/frontend-auto-form"
5
+
6
+ export default {
7
+ defaultLocale: 'en',
8
+ i18n: {
9
+ messages: {
10
+ en: deepmerge.all([
11
+ autoFormLocales.en,
12
+ en.messages
13
+ ])
14
+ },
15
+ numberFormats: {
16
+ en: deepmerge.all([
17
+ en.numberFormats
18
+ ])
19
+ },
20
+ datetimeFormats: {
21
+ en: deepmerge.all([
22
+ en.datetimeFormats
23
+ ])
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,8 @@
1
+ import { clientEntry } from '@live-change/frontend-base/client-entry.js'
2
+ import App from './App.vue'
3
+ import { createRouter } from './router'
4
+ import config from './config.js'
5
+
6
+ clientEntry(App, createRouter, config)
7
+
8
+ window.appStarted = true
@@ -0,0 +1,8 @@
1
+ import { serverEntry, sitemapEntry } from '@live-change/frontend-base/server-entry.js'
2
+ import App from './App.vue'
3
+ import { createRouter, sitemap as routerSitemap } from './router'
4
+ import config from './config.js'
5
+
6
+ const render = serverEntry(App, createRouter, config)
7
+ const sitemap = sitemapEntry(App, createRouter, routerSitemap, config)
8
+ export { render, sitemap }
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div @click="ev => $emit('click', ev)">
3
+ <div v-if="peerState.videoMuted || !stream">
4
+ <UserIdentification :ownerType="ownerType" :owner="owner" />
5
+
6
+ </div>
7
+
8
+ <div>
9
+ <video autoplay playsinline
10
+ :src-object.prop.camel="stream"
11
+ :volume.prop.camel="volume"
12
+ :ref="videoElement"
13
+ @resize="handleVideoResize">
14
+ </video>
15
+ </div>
16
+
17
+ <VolumeIndicator v-if="video.srcObject" :stream="stream"></VolumeIndicator>
18
+
19
+ <div v-if="peerState">
20
+ <i v-if="peerState.videoMuted" class='bx bx-camera-off' />
21
+ <i v-if="peerState.audioState" class='bx bx-microphone-off' />
22
+ </div>
23
+
24
+ </div>
25
+ </template>
26
+
27
+ <script setup>
28
+
29
+ import { VolumeIndicator } from "@live-change/peer-connection"
30
+ import { UserIdentification } from "@live-change/identification-frontend"
31
+
32
+ import { defineProps, defineEmits, toRefs, ref, computed } from 'vue'
33
+
34
+ const props = defineProps({
35
+ stream: {
36
+ type: Object,
37
+ required: true
38
+ },
39
+ ownerType: {
40
+ type: String,
41
+ required: true
42
+ },
43
+ owner: {
44
+ type: String,
45
+ required: true
46
+ },
47
+ peerState: {
48
+ type: Object,
49
+ required: false
50
+ },
51
+ volume: {
52
+ type: Number,
53
+ defaultValue: 1
54
+ }
55
+ })
56
+ const { stream, ownerType, owner, peerState } = toRefs(props)
57
+
58
+ const emit = defineEmits(['resize'])
59
+
60
+ const videoElement = ref(null)
61
+
62
+ function handleVideoResize(event) {
63
+ console.log("HANDLE VIDEO RESIZE EVENT", event.target.videoWidth, event.target.videoHeight)
64
+ if(!event.target.videoWidth || !event.target.videoHeight) {
65
+ console.error("WRONG VIDEO WIDTH OR HEIGHT")
66
+ return
67
+ }
68
+ emit('resize', { width: event.target.videoWidth, height: event.target.videoHeight })
69
+ }
70
+
71
+ </script>
72
+
73
+ <style scoped>
74
+
75
+ </style>
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <LimitedAccess v-slot="{ authorized }" objectType="videoCall_Room" :object="room" :requiredRoles="requiredRoles">
3
+ <div v-if="!joined" class="surface-card shadow-1 border-round p-3 flex flex-row flex-wrap align-items-center">
4
+ <div class="w-30rem m-1" style="max-width: 80vw">
5
+ <DeviceSelect v-model="selectedDevices" />
6
+ </div>
7
+ <div class="m-3 text-center">
8
+ <h3>Select your media devices, and join.</h3>
9
+ <Button @click="join" icon="pi pi-check" label="Join" />
10
+ </div>
11
+ </div>
12
+ <template v-else>
13
+ <p>JOINED</p>
14
+ </template>
15
+ </LimitedAccess>
16
+ </template>
17
+
18
+ <script setup>
19
+ import { LimitedAccess } from "@live-change/access-control-frontend"
20
+ import { DeviceSelect } from '@live-change/peer-connection-frontend'
21
+
22
+ import { defineProps, toRefs, ref, computed } from 'vue'
23
+
24
+ const props = defineProps({
25
+ room: {
26
+ type: String,
27
+ required: true
28
+ }
29
+ })
30
+
31
+ const { room } = toRefs(props)
32
+ const requiredRoles = ['listener', 'speaker']
33
+
34
+ const joined = ref(false)
35
+
36
+ const selectedDevices = ref({ })
37
+
38
+ const canJoin = computed(() => !!selectedDevices.value.userMedia)
39
+
40
+ function join() {
41
+ console.log('Joining room', room.value, selectedDevices.value)
42
+ joined.value = true
43
+ }
44
+
45
+
46
+ </script>
47
+
48
+ <style scoped>
49
+
50
+ </style>
@@ -0,0 +1,143 @@
1
+ <template>
2
+ <div :ref="wall">
3
+ <pre style="display: none">{{ JSON.stringify(videoSizes, null, " ") }}</pre>
4
+ <!--<pre style="display: none">{{ JSON.stringify(allVisibleVideos, null, " ") }}</pre>
5
+ <pre style="display: none">{{ JSON.stringify(allVideos, null, " ") }}</pre>-->
6
+ <VideoDisplayVideo v-for="tile in videoTiles" :style="videoStyles[tile.id]"
7
+ :key="tile.id" :video="tile.video" :volume="volume"
8
+ @videoResize="ev => handleVideoResize(tile, ev)"
9
+ @click="ev => handleVideoClick(tile, ev)">
10
+ </VideoDisplayVideo>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup>
15
+
16
+ import PeerVideo from './PeerVideo.vue'
17
+
18
+ import { defineProps, defineEmits, toRefs, ref, computed, watch } from 'vue'
19
+ import { useElementSize } from '@vueuse/core'
20
+
21
+ const props = defineProps({
22
+ mainVideos: {
23
+ type: Array,
24
+ default: () => [] // testData.mainVideos
25
+ },
26
+ topVideos: {
27
+ type: Array,
28
+ default: () => [] // testData.otherVideos
29
+ },
30
+ otherVideos: {
31
+ type: Array,
32
+ default: () => [] // testData.otherVideos
33
+ },
34
+ myVideos: {
35
+ type: Array,
36
+ default: () => [] // testData.myVideos
37
+ },
38
+ topBarHeight: {
39
+ type: Number,
40
+ default: 80
41
+ },
42
+ bottomBarHeight: {
43
+ type: Number,
44
+ default: 80
45
+ },
46
+ volume: {
47
+ type: Number,
48
+ defaultValue: 1
49
+ }
50
+ })
51
+ const { mainVideos, topVideos, otherVideos, myVideos, topBarHeight, bottomBarHeight, volume } = toRefs(props)
52
+
53
+ const emit = defineEmits(['videoClick'])
54
+
55
+ const allVideos = computed(() => [].concat(mainVideos.value, topVideos.value, otherVideos.value, myVideos.value))
56
+
57
+ const wall = ref(null)
58
+ const wallSize = useElementSize(wall)
59
+
60
+ const videoTiles = ref([])
61
+
62
+ const defaultVideoSize = { width: 640, height: 480 }
63
+
64
+ watch(allVideos, videos => {
65
+ for(const video of videos) {
66
+ const index = videoTiles.value.findIndex(v => v.id === video.id)
67
+ if(index === -1) {
68
+ videoTiles.value.push({ id: video.id, video, size: { ...defaultVideoSize } })
69
+ } else {
70
+ videoTiles.value.splice(index, 1, { id: video.id, video, size: { ...defaultVideoSize } })
71
+ }
72
+ }
73
+ }, { immediate: true })
74
+
75
+ function handleVideoResize(tile, { width, height }) {
76
+ tile.size = { width, height }
77
+ }
78
+
79
+ function handleClick(tile, event) {
80
+ emit('videoClick', { event, ...tile })
81
+ }
82
+
83
+ import allocateSpace from './allocateSpace.js'
84
+
85
+ const videoStyles = computed(() => {
86
+ if(typeof window == 'undefined') return {}
87
+ if(!wallSize?.width || !wallSize?.height) return {}
88
+ const areaSize = wallSize.value
89
+
90
+ let styles = {}
91
+ const bottomBarVisible = otherVideos.value.length > 0 || myVideos.value.length > 0
92
+ const bottomHeight = bottomBarVisible ? bottomBarHeight.value : 0
93
+
94
+ let right = 0
95
+ for(const video of myVideos.value) {
96
+ const size = videoTiles.value.find(v => v.id === video.id)?.size
97
+ if(!size || !size.width || !size.height) {
98
+ styles[myVideo.id] = { display: 'none' }
99
+ continue
100
+ }
101
+ const { width, height } = size
102
+ const ratio = width/height
103
+ const newWidth = bottomBarHeight * ratio
104
+ console.log('NW', newWidth, ratio)
105
+ styles[myVideo.id] = {
106
+ width: newWidth + 'px',
107
+ height: bottomHeight + 'px',
108
+ bottom: '0',
109
+ right: right + 'px'
110
+ }
111
+ right += newWidth
112
+ }
113
+
114
+ const topBarVisible = topVideos.value.length > 0
115
+ const topHeight = topBarVisible ? topBarHeight : 0
116
+
117
+ /// Allocate space for bottom videos
118
+ allocateSpace(0, areaSize.height - bottomHeight,
119
+ areaSize.width - right, bottomHeight,
120
+ otherVideos, styles)
121
+
122
+ /// Allocate space for top videos
123
+ allocateSpace(0, 0,
124
+ areaSize.width, topHeight,
125
+ topVideos, styles)
126
+
127
+ /// Allocate space for main videos
128
+ allocateSpace(0, topHeight,
129
+ areaSize.width, areaSize.height - bottomHeight - topHeight,
130
+ mainVideos, styles)
131
+
132
+ return styles
133
+
134
+ })
135
+
136
+
137
+
138
+ </script>
139
+
140
+
141
+ <style scoped>
142
+
143
+ </style>