mirror of
https://github.com/SrIzan10/helium.git
synced 2026-06-06 00:56:58 +00:00
28 lines
664 B
TypeScript
28 lines
664 B
TypeScript
import { defineStore } from "pinia";
|
|
|
|
export const useStreamerStore = defineStore("streamer", {
|
|
state: () => ({
|
|
code: "",
|
|
peerConnections: {} as Record<string, RTCPeerConnection>,
|
|
iceServers: [] as RTCIceServer[],
|
|
}),
|
|
actions: {
|
|
setCode(code: string) {
|
|
this.code = code;
|
|
},
|
|
addPeerConnection(id: string, pc: RTCPeerConnection) {
|
|
this.peerConnections[id] = pc;
|
|
},
|
|
removePeerConnection(id: string) {
|
|
delete this.peerConnections[id];
|
|
},
|
|
clearPeerConnections() {
|
|
this.peerConnections = {};
|
|
},
|
|
setIceServers(iceServers: RTCIceServer[]) {
|
|
this.iceServers = iceServers;
|
|
},
|
|
},
|
|
});
|
|
|