Skip to content

Commit

Permalink
store: Add allowed protocols in video store
Browse files Browse the repository at this point in the history
* Add allowed protocols in video store and video configuration menu
  • Loading branch information
JoaoMario109 authored and rafaellehmkuhl committed Apr 26, 2024
1 parent d25c729 commit a6f5903
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/stores/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const useVideoStore = defineStore('video', () => {
console.debug('[WebRTC] Using webrtc-adapter for', adapter.browserDetails)

const allowedIceIps = useStorage<string[]>('cockpit-allowed-stream-ips', [])
const allowedIceProtocols = useStorage<string[]>('cockpit-allowed-stream-protocols', [])
const activeStreams = ref<{ [key in string]: StreamData | undefined }>({})
const mainWebRTCManager = new WebRTCManager(webRTCSignallingURI.val, rtcConfiguration)
const availableIceIps = ref<string[]>([])
Expand Down Expand Up @@ -691,6 +692,7 @@ export const useVideoStore = defineStore('video', () => {
return {
availableIceIps,
allowedIceIps,
allowedIceProtocols,
namesAvailableStreams,
videoStoringDB,
tempVideoChunksDB,
Expand Down
29 changes: 28 additions & 1 deletion src/views/ConfigurationVideoView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
available IPs, like those from WiFi and Hotspot connections, preventing lag and stuttering in your video
streams.
</p>
<br />
<p>
Additionally, you can choose specific protocols that will be permitted for use in your video streams. This
selection allows you to choose protocols that could perform better in your network infrastructure, enhancing
the quality of your video streams.
</p>
</div>

<div class="flex w-[30rem] flex-wrap">
Expand All @@ -30,6 +36,21 @@
hint="IP Addresses of the Vehicle allowed to be used for the WebRTC ICE Routing. Usually, the IP of the tether/cabled interface. Blank means any route. E.g: 192.168.2.2"
/>
</div>

<div class="flex w-[30rem] flex-wrap">
<v-combobox
v-model="allowedIceProtocols"
multiple
:items="availableICEProtocols"
label="Allowed WebRTC protocols"
class="w-full my-3 uri-input"
variant="outlined"
chips
clearable
hint="Specific protocols allowed to be used for the WebRTC. Blank means any protocol will be supported."
persistent-hint
/>
</div>
</template>
</BaseConfigurationView>
</template>
Expand All @@ -41,6 +62,12 @@ import { useVideoStore } from '@/stores/video'
import BaseConfigurationView from './BaseConfigurationView.vue'
/**
* Available ICE protocols as described in
* https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate/protocol
*/
const availableICEProtocols = ['udp', 'tcp']
const videoStore = useVideoStore()
const { allowedIceIps, availableIceIps } = storeToRefs(videoStore)
const { allowedIceIps, allowedIceProtocols, availableIceIps } = storeToRefs(videoStore)
</script>

0 comments on commit a6f5903

Please sign in to comment.