Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto egress #52

Open
HandsomeStrife opened this issue May 14, 2023 · 3 comments
Open

Add auto egress #52

HandsomeStrife opened this issue May 14, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@HandsomeStrife
Copy link

With the release of LiveKit Cloud, and their auto egress functionality, I wondered if we might be able to include a setting to automatically record the audio/video to any room joined? Based on https://docs.livekit.io/server/egress/autoegress/ there would need to be an enable option, along with settings for the s3 information (access key, secret key, bucket name and region).

I imagine that it would look something like (in LiveKitClient.ts):

async initializeRoom(): Promise<void> {
    // set the LiveKit publish defaults
    const liveKitPublishDefaults = this.trackPublishOptions;

    // If egress is enabled, add the extra settings
    let egressSettings = undefined;
    if (this.settings.egressEnabled) {
      egressSettings = {
        tracks: {
          filepath: this.settings.s3BucketPath + "/{room_name}-{publisher_identity}-{time}",
          s3 : {
            access_key: this.settings.s3AccessKey,
            secret: this.settings.s3Secret,
            bucket: this.settings.s3Bucket,
            region: this.settings.s3Region
          }
        }
      };
    } else {
      egressSettings = undefined;
    }

    // Set the livekit room options
    const liveKitRoomOptions: RoomOptions = {
      adaptiveStream: liveKitPublishDefaults.simulcast,
      dynacast: liveKitPublishDefaults.simulcast,
      publishDefaults: liveKitPublishDefaults,
      egress: egressSettings,
    };

    // Create and configure the room
    this.liveKitRoom = new Room(liveKitRoomOptions);

    // Set up room callbacks
    this.setRoomCallbacks();
  }

...on the assumption that the settings are registered accordingly. Unfortunately I'm not able to test locally as I'm using Forge to run my instance, and I'm also very unfamiliar with how Foundry modules work with initialising and saving settings. As well as this, I also don't know if it is LiveKitClient or livekit-web-client that need to be altered, or both.

I'd be happy to share some API keys/access privately to facilitate testing though.

@bekriebel
Copy link
Owner

Ohh, interesting. I didn't know that was something they implemented. I can try to take a look at this soon. I'll let you know if some keys are helpful.

@bekriebel bekriebel self-assigned this May 14, 2023
@bekriebel bekriebel added the enhancement New feature or request label May 14, 2023
@HandsomeStrife
Copy link
Author

Amazing, thank you! Currently I have a python script that runs and detects everyone in any rooms and sends LiveKit API calls to record each stream, but that doesn't work with the breakout rooms as I'd have to run the script again to detect it.

Not that I imagine it would be an immediate problem for me, but a thought that had occurred :)

@GamerSeth
Copy link

I would love to see a client side option to set up egress. Our use case is to use the live http://livekit.io project as the signaling server and then have a configuration in the module to set up either do a room composite, track composite or track egress. https://github.com/livekit/egress

We would likely use track composite to record the audio/video or each player got a cloud storage location (S3 compatable)

A peak behind the screen is that we currently record the entire gaming session with OBS and browser capture with the imbedded A/V. But we would love to have individual tracks recorded so that we have the option to post process the sessions for a podcast format using a tool like DaVinci Resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants