Skip to content

Instantly share code, notes, and snippets.

View recursivecodes's full-sized avatar
💯
Living the dream

Todd Sharp recursivecodes

💯
Living the dream
View GitHub Profile
using UnityEngine;
using Momento.Sdk;
using Momento.Sdk.Auth;
using Momento.Sdk.Config;
using Momento.Sdk.Exceptions;
using Momento.Sdk.Responses;
using System.Threading.Tasks;
using System;
using System.Threading;
using System.Collections;

Project Ivy: Creating a Real-Time Live Streaming Vtube Virtual Assistant

Ivy is a virtual assitant that joins your Amazon IVS (get it? Ivy? IVS?) real-time stage, listens for chat messages that are prefixed with "Hey Ivy", and responds!

Objectives

  • ☒ Build a Virtual Assistant in Unity using a VRoid VRM model
  • ☒ Join Amazon IVS Real-Time Stage
  • ☒ Join Amazon IVS Chat Room
  • ☒ Respond to "Hey Ivy!" chat messages by passing the prompt to Amazon Bedrock

Publish to Stage with WHIP

Test Video & Audio Src

gst-launch-1.0 \
  videotestsrc \
  ! videoconvert \
  ! openh264enc \
  ! rtph264pay \
@recursivecodes
recursivecodes / app.js
Created February 1, 2024 13:58
A sample Node script that could be used with the Audible Magic binary to identify copyrighted content in an Amazon IVS live stream.
import 'dotenv/config';
import { spawn } from 'node:child_process';
import { mkdirSync, readFileSync } from 'node:fs';
import { inspect } from 'node:util';
import Watcher from 'watcher';
import { IvsClient, GetStreamCommand } from "@aws-sdk/client-ivs";
import { SQSClient, ReceiveMessageCommand, DeleteMessageCommand } from "@aws-sdk/client-sqs";
// create AWS SDK clients
const ivsClient = new IvsClient();
@recursivecodes
recursivecodes / TwitchPublish.cs
Created January 23, 2024 21:48
A demo of broadcasting directly to Twitch from a game built in Unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.WebRTC;
using UnityEngine.Networking;
using UnityEngine.UI;
[RequireComponent(typeof(AudioListener))]
public class TwitchPublish : MonoBehaviour
{
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using Unity.WebRTC;
using UnityEngine.Networking;
using Unity.RenderStreaming;
using UnityEngine.UI;
using NativeWebSocket;
@recursivecodes
recursivecodes / WebRTCPublish.cs
Created January 23, 2024 14:49
This script is an example of how to create dynamic user controlled cameras and modify the environment and objectives of a Unity game that is live streamed to Amazon IVS.
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using Unity.WebRTC;
using UnityEngine.Networking;
using Cinemachine;
using NativeWebSocket;
[System.Serializable]
@recursivecodes
recursivecodes / IVSChat.cs
Created January 19, 2024 16:46
A script to integrate Amazon IVS chat into a Unity game.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using NativeWebSocket;
using TMPro;
@recursivecodes
recursivecodes / simple-ivs-token-service.js
Last active January 19, 2024 15:32
Install `@aws-sdk/client-ivs-realtime`, `@aws-sdk/client-ivschat` and run with `node simple-ivs-token-service.js`.
import * as http from 'http';
import * as url from 'url';
import { CreateParticipantTokenCommand, IVSRealTimeClient } from "@aws-sdk/client-ivs-realtime";
import { CreateChatTokenCommand, IvschatClient } from "@aws-sdk/client-ivschat";
const ivsChatClient = new IvschatClient();
const ivsRealtimeClient = new IVSRealTimeClient();
const createChatToken = async (chatArn, userId, username) => {
const chatTokenInput = {
@recursivecodes
recursivecodes / WebRTCPublish.cs
Last active January 19, 2024 14:30
This script is a demo of how to broadcast to an Amazon IVS real-time stage from Unity.
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using Unity.WebRTC;
using UnityEngine.Networking;
[System.Serializable]
public class ParticipantToken
{