This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FAB Subtitler experiment. Fix issue where OBS settings couldn't b…
…e saved with an empty password. Fix duplicate navigation error when adding a channel.
- Loading branch information
1 parent
0a90b90
commit 90e4376
Showing
8 changed files
with
175 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<template> | ||
<div> | ||
<!-- <img | ||
:src="channel.iconPath" | ||
class="w-100 col-6 d-block mx-auto mt-2 mb-3" | ||
alt="Zoom" | ||
/> --> | ||
<p class="lead text-center"> | ||
FAB Subtitler | ||
</p> | ||
<!-- <hr /> --> | ||
<!-- <ol> | ||
<li> | ||
<a | ||
href="https://support.zoom.us/hc/en-us/articles/207279736-closed-captioning#h_4cb4e874-d574-4e40-ab12-7d8fae1f71cc" | ||
target="_blank" | ||
>Enable closed captioning</a | ||
> | ||
in your Zoom account. | ||
</li> | ||
<li> | ||
In a Zoom meeting or webinar that you are hosting, click the Closed | ||
Caption button. | ||
</li> | ||
<li> | ||
<a | ||
href="https://support.zoom.us/hc/en-us/articles/207279736-closed-captioning#h_45f95867-9c71-4acd-888f-5a1475b4cd8e" | ||
target="_blank" | ||
>Choose the "Copy API token" option</a | ||
> | ||
and paste the token here. | ||
</li> | ||
</ol> --> | ||
<div class="card card-body"> | ||
<div | ||
v-if="savedChannel && savedChannel.error" | ||
class="alert alert-warning small" | ||
> | ||
<strong class="text-danger"> | ||
<fa icon="exclamation-triangle" /> Error: | ||
</strong> | ||
{{ savedChannel.error }} | ||
</div> | ||
<label for="port" class="font-weight-bold">TCP Port</label> | ||
<input | ||
id="port" | ||
name="port" | ||
v-model="port" | ||
autofocus | ||
class="form-control" | ||
type="url" | ||
placeholder="TCP Port" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
channel: { | ||
required: true, | ||
type: Object, | ||
}, | ||
savedChannel: { | ||
required: false, | ||
type: Object, | ||
}, | ||
}, | ||
mounted() { | ||
this.port = this.savedChannel?.parameters?.port || this.port; | ||
}, | ||
data() { | ||
return { | ||
port: null, | ||
}; | ||
}, | ||
methods: { | ||
updateParameters() { | ||
this.$emit('parametersUpdated', { | ||
port: this.port, | ||
}); | ||
if (this.port) { | ||
this.$emit('formValid'); | ||
} else { | ||
this.$emit('formInvalid'); | ||
} | ||
}, | ||
}, | ||
watch: { | ||
port: { | ||
immediate: true, | ||
handler() { | ||
this.updateParameters(); | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export default async ({ $store, $axios, channelId, channelParameters }) => { | ||
// Register | ||
if (!channelParameters.port) { | ||
$store.commit('UPDATE_CHANNEL_ERROR', { | ||
channelId, | ||
error: 'TCP port number is missing.', | ||
}); | ||
|
||
// Turn off the channel because it's not configured correctly | ||
$store.commit('TOGGLE_CHANNEL_ON_OR_OFF', { channelId, onOrOff: false }); | ||
// No need to unregister here because we haven't registered yet | ||
return; | ||
} | ||
let fabUrl; | ||
try { | ||
fabUrl = new URL(`http://localhost`); | ||
fabUrl.port = channelParameters.port; | ||
// await fetch(fabUrl.toString()); | ||
} catch (e) { | ||
console.error('error', e); | ||
$store.commit('UPDATE_CHANNEL_ERROR', { | ||
channelId, | ||
error: | ||
'Cannot connect to FAB Subtitler. Make sure the port number is correct and try again.', | ||
}); | ||
|
||
// Turn off the channel because it's not configured correctly | ||
$store.commit('TOGGLE_CHANNEL_ON_OR_OFF', { channelId, onOrOff: false }); | ||
// No need to unregister here because we haven't registered yet | ||
return; | ||
} | ||
|
||
// Can successfully connect. Send text to the /speechinterface path | ||
// from now on | ||
fabUrl.pathname = '/speechinterface'; | ||
|
||
const sendToFab = async (text) => { | ||
fabUrl.searchParams.set('text', text); | ||
await fetch(fabUrl); | ||
}; | ||
|
||
const unsubscribeFn = $store.subscribe((mutation) => { | ||
if ( | ||
mutation.type === 'captioner/APPEND_TRANSCRIPT_STABILIZED' && | ||
mutation.payload.transcript | ||
) { | ||
sendToFab(mutation.payload.transcript); | ||
} | ||
}); | ||
|
||
return () => { | ||
// Unregister function | ||
unsubscribeFn(); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters