@ai-matrx/meet 0.7.9 → 0.7.10
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +56 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -7
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +56 -7
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +56 -7
- package/dist/react.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2810,6 +2810,15 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2810
2810
|
handlers.participants([local, ...remotes]);
|
|
2811
2811
|
};
|
|
2812
2812
|
projectRoster = roster;
|
|
2813
|
+
created.on(RoomEvent.TrackSubscribed, (track) => {
|
|
2814
|
+
if (track.kind !== Track.Kind.Audio || typeof document === "undefined") return;
|
|
2815
|
+
const element = track.attach();
|
|
2816
|
+
element.setAttribute("data-mx-meet-audio", "");
|
|
2817
|
+
audioSink().appendChild(element);
|
|
2818
|
+
}).on(RoomEvent.TrackUnsubscribed, (track) => {
|
|
2819
|
+
if (track.kind !== Track.Kind.Audio) return;
|
|
2820
|
+
for (const element of track.detach()) element.remove();
|
|
2821
|
+
});
|
|
2813
2822
|
created.on(RoomEvent.ParticipantConnected, roster).on(RoomEvent.ParticipantDisconnected, roster).on(RoomEvent.TrackSubscribed, roster).on(RoomEvent.TrackUnsubscribed, roster).on(RoomEvent.TrackMuted, roster).on(RoomEvent.TrackUnmuted, roster).on(RoomEvent.LocalTrackPublished, roster).on(RoomEvent.LocalTrackUnpublished, roster).on(RoomEvent.ParticipantNameChanged, roster).on(RoomEvent.ParticipantAttributesChanged, roster).on(RoomEvent.ParticipantMetadataChanged, roster).on(RoomEvent.RoomMetadataChanged, (metadata) => {
|
|
2814
2823
|
handlers.roomMetadata?.(metadata ?? "");
|
|
2815
2824
|
}).on(RoomEvent.ActiveSpeakersChanged, (speakers) => {
|
|
@@ -2825,6 +2834,8 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2825
2834
|
participant?.identity ?? null
|
|
2826
2835
|
);
|
|
2827
2836
|
}).on(RoomEvent.Disconnected, (reason) => {
|
|
2837
|
+
audioContainer?.remove();
|
|
2838
|
+
audioContainer = null;
|
|
2828
2839
|
handlers.disconnected(reason === void 0 ? null : String(reason));
|
|
2829
2840
|
});
|
|
2830
2841
|
try {
|
|
@@ -2866,10 +2877,26 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2866
2877
|
microphone: Track.Source.Microphone,
|
|
2867
2878
|
screen: Track.Source.ScreenShare
|
|
2868
2879
|
};
|
|
2880
|
+
trackEvents = {
|
|
2881
|
+
subscribed: RoomEvent.TrackSubscribed,
|
|
2882
|
+
localPublished: RoomEvent.LocalTrackPublished
|
|
2883
|
+
};
|
|
2869
2884
|
room = created;
|
|
2870
2885
|
return created;
|
|
2871
2886
|
}
|
|
2872
2887
|
let sources = null;
|
|
2888
|
+
let trackEvents = null;
|
|
2889
|
+
let audioContainer = null;
|
|
2890
|
+
function audioSink() {
|
|
2891
|
+
if (audioContainer !== null && audioContainer.isConnected) return audioContainer;
|
|
2892
|
+
const container = document.createElement("div");
|
|
2893
|
+
container.setAttribute("data-mx-meet-audio-sink", "");
|
|
2894
|
+
container.setAttribute("aria-hidden", "true");
|
|
2895
|
+
container.style.display = "none";
|
|
2896
|
+
document.body.appendChild(container);
|
|
2897
|
+
audioContainer = container;
|
|
2898
|
+
return container;
|
|
2899
|
+
}
|
|
2873
2900
|
function requireRoom(operation) {
|
|
2874
2901
|
if (room === null) {
|
|
2875
2902
|
throw new MeetError(
|
|
@@ -2900,6 +2927,8 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2900
2927
|
} catch {
|
|
2901
2928
|
}
|
|
2902
2929
|
projectRoster = null;
|
|
2930
|
+
audioContainer?.remove();
|
|
2931
|
+
audioContainer = null;
|
|
2903
2932
|
await target.disconnect();
|
|
2904
2933
|
},
|
|
2905
2934
|
async setMicrophoneEnabled(enabled) {
|
|
@@ -2965,14 +2994,33 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2965
2994
|
attach(identity, kind, element) {
|
|
2966
2995
|
const target = requireRoom("attach");
|
|
2967
2996
|
const source = sources?.[kind];
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
const
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2997
|
+
if (source === void 0) return () => void 0;
|
|
2998
|
+
let current = null;
|
|
2999
|
+
const sync = () => {
|
|
3000
|
+
const participant = target.localParticipant.identity === identity ? target.localParticipant : target.remoteParticipants.get(identity);
|
|
3001
|
+
const track = participant?.getTrackPublication(source)?.track;
|
|
3002
|
+
if (track === void 0 || track === current) return;
|
|
3003
|
+
current?.detach(element);
|
|
3004
|
+
track.attach(element);
|
|
3005
|
+
current = track;
|
|
3006
|
+
};
|
|
3007
|
+
const onTrack = (...args) => {
|
|
3008
|
+
const who = args[args.length - 1];
|
|
3009
|
+
if (who?.identity === identity) sync();
|
|
3010
|
+
};
|
|
3011
|
+
sync();
|
|
3012
|
+
const events = trackEvents;
|
|
3013
|
+
if (events !== null) {
|
|
3014
|
+
target.on(events.subscribed, onTrack);
|
|
3015
|
+
target.on(events.localPublished, onTrack);
|
|
3016
|
+
}
|
|
2974
3017
|
return () => {
|
|
2975
|
-
|
|
3018
|
+
if (events !== null) {
|
|
3019
|
+
target.off(events.subscribed, onTrack);
|
|
3020
|
+
target.off(events.localPublished, onTrack);
|
|
3021
|
+
}
|
|
3022
|
+
current?.detach(element);
|
|
3023
|
+
current = null;
|
|
2976
3024
|
};
|
|
2977
3025
|
},
|
|
2978
3026
|
activeDevices() {
|
|
@@ -3901,6 +3949,7 @@ function kindOf(person) {
|
|
|
3901
3949
|
if (person.role === "host") return "host";
|
|
3902
3950
|
if (person.role === "cohost") return "cohost";
|
|
3903
3951
|
if (person.role === "guest") return person.userId !== null ? "signed-in guest" : "guest";
|
|
3952
|
+
if (person.userId === null) return "guest";
|
|
3904
3953
|
return "member";
|
|
3905
3954
|
}
|
|
3906
3955
|
function ms(iso) {
|