Skip to content

Commit

Permalink
Merge branch 'dev' into feat/cr-allow-opt-out-for-vrm-export
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAlvarezMelucciDCL committed Apr 15, 2024
2 parents 043efd5 + 1ca1c56 commit 4d73538
Show file tree
Hide file tree
Showing 43 changed files with 596 additions and 318 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ jobs:
- [Open custom protocol](https://renderer-artifacts.decentraland.org/desktop/index.html?dcl://DESKTOP-BRANCH=${{ github.head_ref }})
- [Open custom protocol with Developer Mode](https://renderer-artifacts.decentraland.org/desktop/index.html?dcl://DESKTOP-BRANCH=${{ github.head_ref }}&DESKTOP-DEVELOPER-MODE)
### SDK 6/7:
### SDK 7
- [Open SDK7 scenes playground](https://playground.decentraland.org/?explorer-branch=${{ github.head_ref }})
- [Open SDK7 scenes in preview](https://sdk-test-scenes.decentraland.zone/?position=73,-8&realm=LocalPreview&explorer-branch=${{ github.head_ref }})
- [Open SDK7 goerli plaza scenes](https://decentraland.org/play/?realm=sdk-team-cdn.decentraland.org/ipfs/goerli-plaza-main-latest&position=72%2C-10&explorer-branch=${{ github.head_ref }})
- [Open SDK7 test scenes](https://decentraland.org/play/?realm=sdk-team-cdn.decentraland.org/ipfs/sdk7-test-scenes-main-latest&position=72%2C-10&explorer-branch=${{ github.head_ref }})
### SDK 6
- [Open SDK6 scenes in preview](https://sdk-test-scenes.decentraland.zone/?position=-1,27&realm=LocalPreview&explorer-branch=${{ github.head_ref }})
### More
Expand Down
151 changes: 43 additions & 108 deletions browser-interface/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion browser-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"fp-future": "^1.0.1",
"gifuct-js": "^2.1.2",
"hls.js": "^1.3.4",
"livekit-client": "^1.8.0",
"livekit-client": "^2.0.10",
"mitt": "^3.0.0",
"mz-observable": "^1.0.1",
"redux": "^4.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function registerCommunicationsControllerServiceServerImplementation(port
* The `receiveCommsMessage` relays messages in direction: scene -> comms
*/
const commsController: ICommunicationsController = {
cid: ctx.sceneData.id,
cid: ctx.sceneData.entity.id || ctx.sceneData.id,
receiveCommsMessage(preData: Uint8Array, sender: PeerInformation) {
const [msgType, data] = decodeMessage(preData)
if (msgType === MsgType.String) {
Expand Down Expand Up @@ -85,13 +85,13 @@ export function registerCommunicationsControllerServiceServerImplementation(port
return {
async send(req, ctx) {
const message = textEncoder.encode(req.message)
sendParcelSceneCommsMessage(ctx.sceneData.id, encodeMessage(message, MsgType.String))
sendParcelSceneCommsMessage(commsController.cid, encodeMessage(message, MsgType.String))
return {}
},
async sendBinary(req, ctx) {
// Send messages
for (const data of req.data) {
sendParcelSceneCommsMessage(ctx.sceneData.id, encodeMessage(data, MsgType.Uint8Array))
sendParcelSceneCommsMessage(commsController.cid, encodeMessage(data, MsgType.Uint8Array))
}

// Process received messages
Expand Down
23 changes: 13 additions & 10 deletions browser-interface/packages/shared/comms/adapters/LivekitAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ export class LivekitAdapter implements MinimumCommunicationsAdapter {
public readonly events = mitt<CommsAdapterEvents>()

private disposed = false
private readonly room: Room
private voiceHandler: VoiceHandler

constructor(private config: LivekitConfig) {
this.room = new Room()
static async init(config: LivekitConfig) {
const room = new Room()
const sid = await room.getSid()
return new LivekitAdapter(config, room, sid)
}

private constructor(private config: LivekitConfig, private readonly room: Room, private sid: string) {
this.voiceHandler = createLiveKitVoiceHandler(this.room, this.config.globalAudioStream)

this.room
Expand All @@ -58,13 +61,13 @@ export class LivekitAdapter implements MinimumCommunicationsAdapter {

this.config.logger.log(this.room.name, 'disconnected from room', reason, {
liveKitParticipantSid: this.room.localParticipant.sid,
liveKitRoomSid: this.room.sid
liveKitRoomSid: this.sid
})
trackEvent('disconnection_cause', {
context: 'livekit-adapter',
message: `Got RoomEvent.Disconnected. Reason: ${reason}`,
liveKitParticipantSid: this.room.localParticipant.sid,
liveKitRoomSid: this.room.sid
liveKitRoomSid: this.sid
})
const kicked = reason === DisconnectReason.DUPLICATE_IDENTITY
this.do_disconnect(kicked).catch((err) => {
Expand Down Expand Up @@ -108,14 +111,14 @@ export class LivekitAdapter implements MinimumCommunicationsAdapter {
}

try {
await this.room.localParticipant.publishData(data, reliable ? DataPacket_Kind.RELIABLE : DataPacket_Kind.LOSSY)
await this.room.localParticipant.publishData(data, { reliable })
} catch (err: any) {
// NOTE: for tracking purposes only, this is not a "code" error, this is a failed connection or a problem with the livekit instance
trackEvent('error', {
context: 'livekit-adapter',
message: `Error trying to send data. Reason: ${err.message}`,
stack: err.stack,
saga_stack: `room session id: ${this.room.sid}, participant id: ${this.room.localParticipant.sid}, state: ${state}`
saga_stack: `room session id: ${this.sid}, participant id: ${this.room.localParticipant.sid}, state: ${state}`
})
await this.disconnect()
}
Expand Down Expand Up @@ -144,12 +147,12 @@ export class LivekitAdapter implements MinimumCommunicationsAdapter {

getActiveVideoStreams(): Map<string, ActiveVideoStreams> {
const result = new Map<string, ActiveVideoStreams>()
const participants = this.room.participants
const participants = this.room.remoteParticipants

for (const [sid, participant] of participants) {
if (participant.videoTracks.size > 0) {
if (participant.videoTrackPublications.size > 0) {
const participantTracks = new Map<string, Track>()
for (const [videoSid, track] of participant.videoTracks) {
for (const [videoSid, track] of participant.videoTrackPublications) {
if (track.videoTrack?.mediaStream) {
participantTracks.set(videoSid, track.videoTrack)
}
Expand Down
Loading

0 comments on commit 4d73538

Please sign in to comment.