Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/porter-livekit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"on":
push:
branches:
- test-webrtc
name: "[dev] 🚀 Deploy to Porter.run"
jobs:
porter-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set Github tag
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Setup porter
uses: porter-dev/setup-porter@v0.1.0
- name: Deploy stack
timeout-minutes: 30
run: exec porter apply -f ./porter.yaml
env:
PORTER_APP_NAME: recorder-livekit
PORTER_NAMESPACE: dev
NODE_ENV: development
PORTER_CLUSTER: "4689"
PORTER_DEPLOYMENT_TARGET_ID: 4a24a192-04c8-421f-8fc2-22db1714fdc0
PORTER_HOST: https://dashboard.porter.run
PORTER_PR_NUMBER: ${{ github.event.number }}
PORTER_PROJECT: "15081"
PORTER_REPO_NAME: ${{ github.event.repository.name }}
PORTER_TAG: ${{ steps.vars.outputs.sha_short }}
PORTER_TOKEN: ${{ secrets.PORTER_APP_15081_4689 }}
2 changes: 1 addition & 1 deletion .github/workflows/porter-prod.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"on":
push:
branches:
- main
- fix-audio
name: "[prod] 🚀 Deploy Recorder 🎙️ to Porter.run"
jobs:
porter-deploy:
Expand Down
22 changes: 21 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class RecorderServer extends AppServer {
}));

// Debug middleware for development
app.use(this.debugMiddleware);
app.use(this.debugMiddleware as express.RequestHandler);

// Set up CORS
this.setupCors();
Expand Down Expand Up @@ -181,11 +181,31 @@ class RecorderServer extends AppServer {
* This is called automatically by the AppServer base class
*/
protected async onSession(session: AppSession, sessionId: string, userId: string): Promise<void> {
session.dashboard.content.write("Stock price....");
session.events.onAudioChunk((chunk => {
this.logger.debug(`Audio chunk received: ${chunk.arrayBuffer?.byteLength} bytes`);
}))
console.log(`New TPA session: ${sessionId} for user ${userId}`);

// Set up SDK session handlers for audio and transcription
recordingsService.setupSDKSession(session, sessionId, userId);

// Optional: auto-start a recording when a session starts (for diagnostics)
const autoStart = (process.env.RECORDER_AUTO_START_ON_SESSION || '').toLowerCase();
const shouldAutoStart = autoStart === 'true' || autoStart === '1' || autoStart === 'yes';
if (shouldAutoStart) {
console.log(`[AUTO] RECORDER_AUTO_START_ON_SESSION enabled — attempting to auto-start recording for ${userId}`);
try {
// Mark as voice-initiated to bypass any active-session gating logic
const recId = await recordingsService.startRecording(userId, /*isVoiceInitiated*/ true);
console.log(`[AUTO] Auto-started recording ${recId} for user ${userId}`);
} catch (err) {
console.error(`[AUTO] Failed to auto-start recording for user ${userId}:`, err);
}
} else {
console.log(`[AUTO] RECORDER_AUTO_START_ON_SESSION disabled — not auto-starting recording`);
}

// Show welcome message on glasses
session.layouts.showTextWall("MentraOS Recorder App - Open the webview to manage recordings!");
}
Expand Down
Loading
Loading