Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
fix: prism imports for esm
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Oct 30, 2021
1 parent 7e493c7 commit 9222dbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions examples/recorder/src/createListeningStream.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EndBehaviorType, VoiceReceiver } from '@discordjs/voice';
import { User } from 'discord.js';
import { createWriteStream } from 'node:fs';
import { opus } from 'prism-media';
import * as prism from 'prism-media';
import { pipeline } from 'node:stream';

function getDisplayName(userId: string, user?: User) {
Expand All @@ -16,8 +16,8 @@ export function createListeningStream(receiver: VoiceReceiver, userId: string, u
},
});

const oggStream = new opus.OggLogicalBitstream({
opusHead: new opus.OpusHead({
const oggStream = new prism.opus.OggLogicalBitstream({
opusHead: new prism.opus.OpusHead({
channelCount: 2,
sampleRate: 48000,
}),
Expand Down
6 changes: 3 additions & 3 deletions src/util/demuxProbe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Readable } from 'node:stream';
import { opus } from 'prism-media';
import * as prism from 'prism-media';
import { noop } from './util';
import { StreamType } from '..';

Expand Down Expand Up @@ -83,11 +83,11 @@ export function demuxProbe(
}
};

const webm = new opus.WebmDemuxer();
const webm = new prism.opus.WebmDemuxer();
webm.once('error', noop);
webm.on('head', foundHead(StreamType.WebmOpus));

const ogg = new opus.OggDemuxer();
const ogg = new prism.opus.OggDemuxer();
ogg.once('error', noop);
ogg.on('head', foundHead(StreamType.OggOpus));

Expand Down
4 changes: 2 additions & 2 deletions src/util/generateDependencyReport.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-require-imports */
import { resolve, dirname } from 'node:path';
import { FFmpeg } from 'prism-media';
import * as prism from 'prism-media';

/**
* Generates a report of the dependencies used by the \@discordjs/voice module.
Expand Down Expand Up @@ -32,7 +32,7 @@ export function generateDependencyReport() {
// ffmpeg
report.push('FFmpeg');
try {
const info = FFmpeg.getInfo();
const info = prism.FFmpeg.getInfo();
report.push(`- version: ${info.version}`);
report.push(`- libopus: ${info.output.includes('--enable-libopus') ? 'yes' : 'no'}`);
} catch (err) {
Expand Down

0 comments on commit 9222dbf

Please sign in to comment.